基质喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

61 lines
1.8 KiB

// #include "zdelay.h"
//
// #include "zbase.h"
// #include "project_configs.h"
//
// extern TIM_HandleTypeDef SDK_DELAY_US_TIMER;
//
// static HAL_StatusTypeDef _HAL_TIM_Base_Start(TIM_HandleTypeDef* htim) __attribute__((optimize("O2")));
// static HAL_StatusTypeDef _HAL_TIM_Base_Stop(TIM_HandleTypeDef* htim) __attribute__((optimize("O2")));
// static HAL_StatusTypeDef _HAL_TIM_Base_Start(TIM_HandleTypeDef* htim) {
// uint32_t tmpsmcr;
// /* Check the TIM state */
// if (htim->State != HAL_TIM_STATE_READY) {
// return HAL_ERROR;
// }
// htim->State = HAL_TIM_STATE_BUSY;
// if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) {
// tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
// if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr)) {
// __HAL_TIM_ENABLE(htim);
// }
// } else {
// __HAL_TIM_ENABLE(htim);
// }
// return HAL_OK;
// }
// static HAL_StatusTypeDef _HAL_TIM_Base_Stop(TIM_HandleTypeDef* htim) {
// /* Disable the Peripheral */
// __HAL_TIM_DISABLE(htim);
// /* Set the TIM state */
// htim->State = HAL_TIM_STATE_READY;
// /* Return function status */
// return HAL_OK;
// }
//
// void zdelay_us(int var_nus) {
// volatile uint32_t counter = 0;
// __HAL_TIM_SET_COUNTER(&SDK_DELAY_US_TIMER, 0);
// _HAL_TIM_Base_Start(&SDK_DELAY_US_TIMER);
// while (counter < var_nus) {
// counter = __HAL_TIM_GET_COUNTER(&SDK_DELAY_US_TIMER);
// }
// _HAL_TIM_Base_Stop(&SDK_DELAY_US_TIMER);
// }
// void zdelay_ms(int ms) {
// for (int i = 0; i < ms; i++) {
// zdelay_us(1000);
// }
// }
// void zos_delay_ms(int ms) { osDelay(ms); }
//
// uint32_t zget_ticket(void) { return HAL_GetTick(); }
//
// uint32_t zhas_passedms(uint32_t ticket) {
// uint32_t now = HAL_GetTick();
// if (now >= ticket) {
// return now - ticket;
// } else {
// return 0xFFFFFFFF - ticket + now;
// }
// }