mirror of https://github.com/ARMmbed/mbed-os.git
We handle including header by W7500x_conf.h.
But now I deleted the W7500x_conf.h and all peri drivers have own including header. And some code are optimized and removed warning.pull/1318/head
parent
01ce5e6580
commit
3208676d7a
|
@ -1146,6 +1146,22 @@ typedef struct
|
|||
//ToDo
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PAD_PA = 0,
|
||||
PAD_PB,
|
||||
PAD_PC,
|
||||
PAD_PD
|
||||
}PAD_Type;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PAD_AF0 = Px_AFSR_AF0,
|
||||
PAD_AF1 = Px_AFSR_AF1,
|
||||
PAD_AF2 = Px_AFSR_AF2,
|
||||
PAD_AF3 = Px_AFSR_AF3
|
||||
}PAD_AF_TypeDef;
|
||||
|
||||
|
||||
#if !defined (USE_HAL_DRIVER)
|
||||
#define USE_HAL_DRIVER
|
||||
|
|
|
@ -46,9 +46,6 @@ typedef enum {
|
|||
UART_1 = (int)W7500x_UART1_BASE
|
||||
} UARTName;
|
||||
|
||||
#define STDIO_UART_TX PC_2
|
||||
#define STDIO_UART_RX PC_3
|
||||
#define STDIO_UART UART_1
|
||||
|
||||
typedef enum {
|
||||
SPI_0 = (int)SSP0_BASE,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "W7500x.h"
|
||||
#include "W7500x_adc.h"
|
||||
|
||||
void ADC_PowerDownEnable (FunctionalState NewState)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
/* Includes -------------------------------------------*/
|
||||
#include "W7500x.h"
|
||||
#include "W7500x_dualtimer.h"
|
||||
|
||||
void DUALTIMER_ClockEnable(DUALTIMER_TypeDef* DUALTIMERn)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "W7500x.h"
|
||||
|
||||
#include "W7500x_exti.h"
|
||||
#include "W7500x_gpio.h"
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "W7500x.h"
|
||||
|
||||
|
||||
#include "W7500x_gpio.h"
|
||||
|
||||
void HAL_GPIO_DeInit(GPIO_TypeDef* GPIOx)
|
||||
{
|
||||
|
|
|
@ -83,21 +83,6 @@ typedef enum
|
|||
Bit_SET
|
||||
}BitAction;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PAD_PA = 0,
|
||||
PAD_PB,
|
||||
PAD_PC,
|
||||
PAD_PD
|
||||
}PAD_Type;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PAD_AF0 = Px_AFSR_AF0,
|
||||
PAD_AF1 = Px_AFSR_AF1,
|
||||
PAD_AF2 = Px_AFSR_AF2,
|
||||
PAD_AF3 = Px_AFSR_AF3
|
||||
}PAD_AF_TypeDef;
|
||||
|
||||
#define IS_PAD_TYPE(Px) (((Px) == PAD_PA) || ((Px) == PAD_PB) \
|
||||
((Px) == PAD_PC) || ((Px) == PAD_PD))
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
*******************************************************************************
|
||||
*/
|
||||
/*include -------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include "W7500x.h"
|
||||
#include "W7500x_i2c.h"
|
||||
#include "W7500x_gpio.h"
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitDef;
|
||||
|
||||
|
@ -61,8 +62,8 @@ uint32_t I2C_Init(I2C_ConfigStruct* conf)
|
|||
HAL_GPIO_ResetBits((GPIO_TypeDef*)(GPIOA_BASE + (sda_port_num << 24)), sda_pin_index);
|
||||
|
||||
//Pin muxing
|
||||
HAL_PAD_AFConfig(scl_port_num, scl_pin_index, PAD_AF1);
|
||||
HAL_PAD_AFConfig(sda_port_num, sda_pin_index, PAD_AF1);
|
||||
HAL_PAD_AFConfig((PAD_Type)scl_port_num, (uint16_t)scl_pin_index, PAD_AF1);
|
||||
HAL_PAD_AFConfig((PAD_Type)sda_port_num, (uint16_t)sda_pin_index, PAD_AF1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -98,9 +99,6 @@ uint8_t I2C_ReadBitSDA(I2C_ConfigStruct* conf)
|
|||
|
||||
if(HAL_GPIO_ReadInputDataBit((GPIO_TypeDef*)(GPIOA_BASE + (sda_port_num << 24)), sda_pin_index))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -193,7 +191,7 @@ int I2C_Write(I2C_ConfigStruct* conf, uint8_t addr, uint8_t* data, uint32_t len)
|
|||
//Write addr
|
||||
if(I2C_WriteByte(conf, addr) != 0)
|
||||
{
|
||||
printf("Received NACK at address phase!!\r\n");
|
||||
//printf("Received NACK at address phase!!\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -218,7 +216,7 @@ int I2C_WriteRepeated(I2C_ConfigStruct* conf, uint8_t addr, uint8_t* data, uint3
|
|||
//Write addr
|
||||
if(I2C_WriteByte(conf, addr) != 0)
|
||||
{
|
||||
printf("Received NACK at address phase!!\r\n");
|
||||
//printf("Received NACK at address phase!!\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -241,7 +239,7 @@ int I2C_Read(I2C_ConfigStruct* conf, uint8_t addr, uint8_t* data, uint32_t len)
|
|||
//Write addr | read command
|
||||
if(I2C_WriteByte(conf, (addr | 1)) != 0)
|
||||
{
|
||||
printf("Received NACK at address phase!!\r\n");
|
||||
//printf("Received NACK at address phase!!\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -270,7 +268,7 @@ int I2C_ReadRepeated(I2C_ConfigStruct* conf, uint8_t addr, uint8_t* data, uint32
|
|||
//Write addr | read command
|
||||
if(I2C_WriteByte(conf, (addr | 1)) != 0)
|
||||
{
|
||||
printf("Received NACK at address phase!!\r\n");
|
||||
//printf("Received NACK at address phase!!\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
*******************************************************************************
|
||||
*/
|
||||
/*include -------------------------------------*/
|
||||
#include "W7500x.h"
|
||||
|
||||
#ifndef __W7500X_I2C_H
|
||||
#define __W7500X_I2C_H
|
||||
|
||||
#include "W7500x.h"
|
||||
|
||||
|
||||
typedef enum {
|
||||
I2C_PA_5 = 0x05,
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
/* Includes -------------------------------------------*/
|
||||
#include "W7500x.h"
|
||||
#include "W7500x_pwm.h"
|
||||
|
||||
void PWM_DeInit(PWM_CHn_TypeDef* PWM_CHn)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "W7500x.h"
|
||||
#include "W7500x_uart.h"
|
||||
|
||||
void UART_StructInit(UART_InitTypeDef* UART_InitStruct)
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "wait_api.h"
|
||||
#include "cmsis.h"
|
||||
#include "pinmap.h"
|
||||
#include "W7500x_adc.h"
|
||||
#include "PeripheralPins.h"
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ static uint32_t channel_ids[4][16];
|
|||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
void port_generic_handler(GPIO_TypeDef* GPIOx, uint32_t port_num);
|
||||
|
||||
void PORT0_Handler(void)
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#define MBED_GPIO_OBJECT_H
|
||||
|
||||
#include "mbed_assert.h"
|
||||
#include "W7500x_gpio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "wait_api.h"
|
||||
#include "us_ticker_api.h"
|
||||
#include "W7500x_i2c.h"
|
||||
|
||||
/* Timeout values for flags and events waiting loops. These timeouts are
|
||||
not based on accurate values, they just guarantee that the application will
|
||||
|
@ -106,12 +107,12 @@ int i2c_read(i2c_t *obj, int address, char *data, int length, int stop)
|
|||
|
||||
if(stop)
|
||||
{
|
||||
if(I2C_Read(&conf, address, data, length) != 0)
|
||||
if(I2C_Read(&conf, address, (uint8_t*)data, length) != 0)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(I2C_ReadRepeated(&conf, address, data, length) != 0)
|
||||
if(I2C_ReadRepeated(&conf, address, (uint8_t*)data, length) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -129,12 +130,12 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop)
|
|||
|
||||
if(stop)
|
||||
{
|
||||
if(I2C_Write(&conf, address, data, length) != 0)
|
||||
if(I2C_Write(&conf, address, (uint8_t*)data, length) != 0)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(I2C_WriteRepeated(&conf, address, data, length) != 0)
|
||||
if(I2C_WriteRepeated(&conf, address, (uint8_t*)data, length) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include "pinmap.h"
|
||||
#include "PortNames.h"
|
||||
#include "mbed_error.h"
|
||||
#include "W7500x.h"
|
||||
#include "W7500x_gpio.h"
|
||||
|
||||
|
||||
uint32_t Get_GPIO_BaseAddress(uint32_t port_idx)
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "pinmap.h"
|
||||
#include "mbed_error.h"
|
||||
#include "PeripheralPins.h"
|
||||
#include "W7500x_pwm.h"
|
||||
|
||||
static PWM_TimerModeInitTypeDef TimerModeStructure;
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "rtc_api.h"
|
||||
#include "cmsis.h"
|
||||
#include "W7500x_pwm.h"
|
||||
|
||||
time_t wiz_rtc_time;
|
||||
char rtc_enabled = 0;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "pinmap.h"
|
||||
#include <string.h>
|
||||
#include "PeripheralPins.h"
|
||||
#include "W7500x_uart.h"
|
||||
|
||||
#define UART_NUM (2)
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include "us_ticker_api.h"
|
||||
#include "PeripheralNames.h"
|
||||
#include "system_W7500x.h"
|
||||
#include "W7500x_dualtimer.h"
|
||||
#include "W7500x_pwm.h"
|
||||
|
||||
#define TIMER_0 DUALTIMER0_0
|
||||
#define TIMER_1 PWM_CH1
|
||||
|
|
Loading…
Reference in New Issue