Skip to content

Commit

Permalink
refactor: (Tree) source -> module
Browse files Browse the repository at this point in the history
  • Loading branch information
but0n committed Aug 28, 2017
1 parent 6e16c3b commit f0b8ca0
Show file tree
Hide file tree
Showing 22 changed files with 45 additions and 6,329 deletions.
2 changes: 1 addition & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ INCLUDE+=-I$(STMLIB)/CMSIS/Device/ST/STM32F10x/Include
INCLUDE+=-I$(STMLIB)/CMSIS/Device/ST/STM32F10x/Source/Templates
INCLUDE+=-I$(STMLIB)/STM32F10x_StdPeriph_Driver/inc
INCLUDE+=-I$(STMLIB)/STM32_USB-FS-Device_Driver/inc
INCLUDE+=-I$(LIBDIR)/include
INCLUDE+=-I$(LIBDIR)/module
COMMONFLAGS=-g -mcpu=cortex-m3 -mthumb -std=c99
COMMONFLAGSlib=$(COMMONFLAGS)
#Commands for general Makefile and src Makefile
Expand Down
6 changes: 3 additions & 3 deletions libs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ libstm32.a:
@cd $(STMLIB)/CMSIS/Device/ST/STM32F10x/Source/Templates && \
$(CC) $(CFLAGSlib) \
system_stm32f10x.c
@cd $(LIBDIR)/source && \
@cd $(LIBDIR)/module && \
$(CC) $(CFLAGSlib) \
-D"assert_param(expr)=((void)0)" \
-I../STM32_USB-FS-Device_Lib_V4.0.0/Libraries/CMSIS/Include \
Expand All @@ -28,7 +28,7 @@ libstm32.a:
# *.c
@$(AR) cr $(LIBDIR)/$@ \
$(STMLIB)/CMSIS/Device/ST/STM32F10x/Source/Templates/system_stm32f10x.o \
$(LIBDIR)/source/*.o \
$(LIBDIR)/module/*.o \
# $(STMLIB)/STM32_USB-FS-Device_Driver/src/*.o
@echo "done."
.PHONY: libs clean tshow
Expand All @@ -37,7 +37,7 @@ clean:
rm -f $(STMLIB)/CMSIS/Device/ST/STM32F10x/Source/Templates/system_stm32f10x.o
rm -f $(STMLIB)/STM32F10x_StdPeriph_Driver/src/*.o
rm -f $(STMLIB)/STM32_USB-FS-Device_Driver/src/*.o
rm -f $(LIBDIR)/source/*.o
rm -f $(LIBDIR)/module/*.o
rm -f $(LIBS)
tshow:
@echo "######################################################################################################"
Expand Down
4 changes: 2 additions & 2 deletions libs/include/bit.h → libs/module/avm_bit.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef BIT_H
#define BIT_H
#ifndef _AVM_BIT_H_
#define _AVM_BIT_H_

#define BITBAND(addr, bitnum) (((addr) & 0xF0000000) + 0x2000000 + (((addr) & 0xFFFFF) << 5) + ((bitnum)<<2))
#define BIT_ADDR(addr, bitnum) *((volatile unsigned long *)(BITBAND((unsigned int)(addr), bitnum)))
Expand Down
4 changes: 2 additions & 2 deletions libs/source/i2c.c → libs/module/avm_i2c.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "i2c.h"
#include "avm_i2c.h"

#include "stm32f10x.h"
#include "bit.h"
#include "avm_bit.h"

void delay_us(volatile unsigned int nus) {
for(nus *= 4; nus; nus--);
Expand Down
5 changes: 2 additions & 3 deletions libs/include/i2c.h → libs/module/avm_i2c.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

#ifndef I2C_H
#define I2C_H
#ifndef _AVM_I2C_H_
#define _AVM_I2C_H_


#define SCL_PINNUM 15
Expand Down
2 changes: 1 addition & 1 deletion libs/source/motor.c → libs/module/avm_motor.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "motor.h"
#include "avm_motor.h"
#include "stm32f10x.h"

//A7
Expand Down
4 changes: 2 additions & 2 deletions libs/include/motor.h → libs/module/avm_motor.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef MOTOR_H
#define MOTOR_H
#ifndef _AVM_MOTOR_H_
#define _AVM_MOTOR_H_

#define MOTOR_NORMAL_STARTUP

Expand Down
8 changes: 4 additions & 4 deletions libs/source/mpu6050.c → libs/module/avm_mpu6050.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "mpu6050.h"
#include "avm_mpu6050.h"

#include "bit.h"
#include "avm_bit.h"
#include "stm32f10x.h"
#include "i2c.h"
#include "uart.h"
#include "avm_i2c.h"
#include "avm_uart.h"

void MPU_Sigle_Write(unsigned char reg_addr, unsigned char reg_data) {
IIC_Start();
Expand Down
4 changes: 2 additions & 2 deletions libs/include/mpu6050.h → libs/module/avm_mpu6050.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef MPU6050_H
#define MPU6050_H
#ifndef _AVM_MPU6050_H_
#define _AVM_MPU6050_H_

//=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_
#define LED0 BIT_ADDR((GPIOA_BASE+12), 8)
Expand Down
4 changes: 2 additions & 2 deletions libs/source/pid.c → libs/module/avm_pid.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "stm32f10x.h"
#include "pid.h"
#include "motor.h"
#include "avm_pid.h"
#include "avm_motor.h"

void pid_SingleAxis(pid_pst temp, float setPoint) {
temp->Error = *temp->Feedback - setPoint;
Expand Down
4 changes: 2 additions & 2 deletions libs/include/pid.h → libs/module/avm_pid.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef PID_H
#define PID_H
#ifndef _AVM_PID_H_
#define _AVM_PID_H_

extern float g_Yaw, g_Pitch, g_Roll; //eular

Expand Down
4 changes: 2 additions & 2 deletions libs/include/tty.h → libs/module/avm_tty.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef TTY_H
#define TTY_H
#ifndef _AVM_TTY_H_
#define _AVM_TTY_H_

#define TTY_NONE() uart_sendStr("\033[m")
#define TTY_RED() uart_sendStr("\033[41;30m")
Expand Down
2 changes: 1 addition & 1 deletion libs/source/uart.c → libs/module/avm_uart.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "uart.h"
#include "avm_uart.h"
#include "stm32f10x.h"

int top = -1; //Stack Pointer
Expand Down
4 changes: 2 additions & 2 deletions libs/include/uart.h → libs/module/avm_uart.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef UART_H
#define UART_H
#ifndef _AVM_UART_H_
#define _AVM_UART_H_

void uart_init(unsigned int pclk2, unsigned int bound);
void uart_sendData(unsigned char data);
Expand Down
2 changes: 1 addition & 1 deletion libs/source/wifi.c → libs/module/avm_wifi.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "wifi.h"
#include "avm_wifi.h"

#include "stm32f10x.h"

Expand Down
4 changes: 2 additions & 2 deletions libs/include/wifi.h → libs/module/avm_wifi.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef WIFI_H
#define WIFI_H
#ifndef _AVM_WIFI_H_
#define _AVM_WIFI_H_
//Only USART1 PCLK2 = 72
#define WIFI_PCLK2 36
#define WIFI_BOUND 115200
Expand Down
43 changes: 0 additions & 43 deletions libs/source/cli.c

This file was deleted.

Loading

0 comments on commit f0b8ca0

Please sign in to comment.