-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 573ecb6
Showing
12 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/*! | ||
* A power value in Watt. | ||
* Resolution: 1 Watt. | ||
*/ | ||
|
||
|
||
struct Watt | ||
{ | ||
|
||
private: | ||
int watt; | ||
|
||
public: | ||
/*! | ||
* Initialize a watt value from a U16. | ||
* 1 W = Watt(1) | ||
*/ | ||
explicit Watt(int watt); | ||
/*! | ||
* Get the number of watts as a U16. | ||
*/ | ||
int getWatt(); | ||
|
||
Watt(); | ||
}; | ||
|
||
struct dBm | ||
{ | ||
private: | ||
/*! | ||
* The actual dB-value in units of 0.1 dB. | ||
* I.e, if db has the numerical value 42, | ||
* that means 4.2 dB. | ||
*/ | ||
int dbm; | ||
|
||
public: | ||
|
||
dBm(); | ||
explicit dBm(float powerdBm); | ||
|
||
/*! | ||
* Construct a dBm value given a Watt value | ||
* Conversion is given by 10*log10(Watt)+30 | ||
*/ | ||
static dBm fromWatt(Watt w); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# UNIX Makefile | ||
|
||
PROJ_DIR = /home/docooler/workspace/c_plus_plus/name_define | ||
|
||
#var makefile | ||
include config.Makefile | ||
|
||
#module makefile | ||
include $(PROJ_DIR)/sw/swModule.Makefile | ||
|
||
#target makefile | ||
include targets.Makefile | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
CXX = g++ | ||
LD = g++ | ||
CXXFLAGS = -g | ||
|
||
BIN_DIR = $(PROJ_DIR)/bin | ||
OBJ_DIR = $(BIN_DIR)/obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
help: | ||
@echo $(OBJ) | ||
all: $(OBJ) | ||
@$(LD) -o $(BIN_DIR)/tmf $(OBJ) | ||
|
||
run: all | ||
@$(BIN_DIR)/tmf | ||
|
||
clean: | ||
echo "$(RM)" | ||
$(RM) $(OBJ) $(BIN_DIR)/tmf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include"common.h" | ||
|
||
Watt::Watt(int watt) | ||
{ | ||
this->watt = watt; | ||
} | ||
|
||
Watt::Watt() | ||
{ | ||
this->watt = 0; | ||
} | ||
|
||
int Watt::getWatt() | ||
{ | ||
return watt; | ||
} | ||
|
||
dBm::dBm() | ||
{ | ||
dbm = -0x8000; | ||
} | ||
dBm::dBm(float powerdBm) | ||
{ | ||
dbm = static_cast<int>(10.0f * powerdBm); | ||
} | ||
|
||
dBm dBm::fromWatt(Watt w) | ||
{ | ||
dBm db; | ||
return db; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <iostream> | ||
#include "common.h" | ||
|
||
using namespace std; | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
Watt w(13); | ||
cout <<w.getWatt()<<endl; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
INCLUDE = -I$(PROJ_DIR)/inc | ||
TOTAL_FILE = main.cc \ | ||
common.cc | ||
|
||
OBJ = $(TOTAL_FILE:%.cc=$(OBJ_DIR)/%.o) | ||
|
||
swobj:$(OBJ) | ||
@echo "make obj" | ||
|
||
$(OBJ_DIR)/%.o: $(PROJ_DIR)/sw/%.cc | ||
@mkdir -p $(@D) | ||
@$(CXX) -c $(INCLUDE) -o $@ $< |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include<iostream> | ||
|
||
using namespace std; | ||
|
||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
cout<<"hello world"<<endl; | ||
return 0; | ||
} |