Initial import: PWM32E C/W 100% firmware
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
/*!
|
||||
* \file main.h
|
||||
*
|
||||
* \brief The head file of main.c
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "xc6xxx.h"
|
||||
|
||||
#include "pwm.h"
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
TypeDef
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Exported Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MAIN_H__ */
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
/*!
|
||||
* \file pwm_test.h
|
||||
*
|
||||
* \brief The head file of pwm_test.c
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __PWM_TEST_H__
|
||||
#define __PWM_TEST_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
#define DEVIATION_FREQ 10
|
||||
#define DEVIATION_DUTYCYCLE 10
|
||||
#define CAPTURE_DATA_MAX 101
|
||||
#define CAPTURE_VALID_POS 4
|
||||
/*------------------------------------------------------------------------------------
|
||||
TypeDef
|
||||
-------------------------------------------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
PWM_CAP_IDLE = 0,
|
||||
PWM_CAP_FREQ,
|
||||
PWM_CAP_DUTYCYCLE,
|
||||
PWM_CAP_RIGHT,
|
||||
PWM_CAP_ERROR,
|
||||
} PWM_CAP_STA_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PWM_BRK_IDLE = 0,
|
||||
PWM_BRK_START,
|
||||
PWM_BRK_STOP,
|
||||
} PWM_BRK_STA_TypeDef;
|
||||
typedef enum
|
||||
{
|
||||
PWM_BRK_CAP_VALID,
|
||||
PWM_BRK_CAP_RECOVERY,
|
||||
PWM_BRK_CAP_ERROR,
|
||||
} PWM_BRK_CAP_STA_TypeDef;
|
||||
typedef struct pwm_ch_cap_freq
|
||||
{
|
||||
uint16_t ch0_cap_freq;
|
||||
uint16_t ch1_cap_freq;
|
||||
uint16_t ch2_cap_freq;
|
||||
} pwm_ch_cap_freq_t;
|
||||
typedef struct pwm_ch_cap_dutycycle
|
||||
{
|
||||
uint16_t ch0_cap_dutycycle;
|
||||
uint16_t ch1_cap_dutycycle;
|
||||
uint16_t ch2_cap_dutycycle;
|
||||
} pwm_ch_cap_dutycycle_t;
|
||||
typedef struct pwm_ch_cap_type
|
||||
{
|
||||
uint8_t ch0_cap_type;
|
||||
uint8_t ch1_cap_type;
|
||||
uint8_t ch2_cap_type;
|
||||
} pwm_ch_cap_type_t;
|
||||
typedef enum
|
||||
{
|
||||
PWM_CAP_TYPE_FREQ,
|
||||
PWM_CAP_TYPE_DUTYCYCLE,
|
||||
} PWM_CAP_TYPE_TypeDef;
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Exported Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
void pwm_demo(void);
|
||||
uint32_t find_duplicate_data(uint16_t *buff, uint16_t size);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PWM_TEST_H__ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user