Skip to content

Commit

Permalink
Support for Joyetech eVic VTwo Mini (vtwom)
Browse files Browse the repository at this point in the history
This commit introduces the porting framework and adds support for the VTwo
Mini, target name 'vtwom'. It also includes dependency support for ASM files
and a few additions to .gitignore.
  • Loading branch information
ReservedField committed Oct 30, 2016
1 parent b5f8447 commit c1e7bc5
Show file tree
Hide file tree
Showing 20 changed files with 381 additions and 66 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/doc/
/example/**/obj/
/example/**/bin/
/obj/
/lib/
/nuvoton-sdk/
/src/startup/evicsdk_tag.s

*.o
*.d
*.a
*.map
*.lst
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

include $(EVICSDK)/make/Helper.mk
include $(EVICSDK)/make/Common.mk
include $(EVICSDK)/make/Device.mk

# Output targets.
TARGET_SDK := libevicsdk
Expand Down Expand Up @@ -132,7 +133,8 @@ __get-sdktag = evic-sdk-$(or $(strip $(shell \
$(if $(EVICSDK_MAKE_DEBUG),$(info SDK tag: $(get-sdktag)))

# All objects, excluding debug-only objects.
OBJS_ALL := $(OBJS_SDK) $(OBJS_NUVO) $(OBJS_CRT0)
OBJS_ALL := $(OBJS_SDK) $(OBJS_NUVO) $(OBJS_CRT0) \
$(call tmpl-flavor,devobjs-tmpl) $(call tmpl-flavor,devobjs-crt0-tmpl)
# All debug-only objects.
OBJS_ALL_DBG := $(OBJS_CRT0_DBG)

Expand Down Expand Up @@ -190,13 +192,15 @@ $(lib-all): | $$(@D)
$(AR) -rc $(call fixpath-bu,$@) $(call fixpath-bu,$^))

# Build SDK objects for SDK library.
$(sdk-all): $$(call tmpl-build,objs-tmpl,$$(OBJS_SDK))
$(sdk-all): $$(call tmpl-build,objs-tmpl,$$(OBJS_SDK) \
$$(call tmpl-build,devobjs-tmpl))

# Build Nuvoton SDK objects for Nuvoton SDK library.
$(nuvo-all): $$(call tmpl-build,objs-tmpl,$$(OBJS_NUVO))

# Rule to link crt0 objects into a partially linked object.
$(crt0-all): $$(call tmpl-build,objs-tmpl,$$(OBJS_CRT0)) | $$(@D)
$(crt0-all): $$(call tmpl-build,objs-tmpl,$$(OBJS_CRT0) \
$$(call tmpl-build,devobjs-crt0-tmpl)) | $$(@D)
$(call info-cmd,LNK)
@$(call trace, \
$(LD) -r $(call fixpath-bu,$^) -o $(call fixpath-bu,$@))
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ flavor.
**Supported devices:**

- `evic`: Joyetech eVic VTC Mini
- `vtwom`: Joyetech eVic VTwo Mini
- `all`: all of the above

**Build flavors:**
Expand Down
27 changes: 27 additions & 0 deletions device/evic/Device.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is part of eVic SDK.
#
# eVic SDK is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# eVic SDK is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with eVic SDK. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2016 ReservedField

ifndef __evicsdk_make_device_evic_inc
__evicsdk_make_device_evic_inc := 1

include $(EVICSDK)/make/Device.mk

$(call add-device,evic, \
device/evic/src/Device.o, \
device/evic/src/startup.o)

endif # __evicsdk_make_device_evic_inc
26 changes: 26 additions & 0 deletions device/evic/include/Device.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* This file is part of eVic SDK.
*
* eVic SDK is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* eVic SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with eVic SDK. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2016 ReservedField
*/

#ifndef EVICSDK_DEVICE_EVIC_H
#define EVICSDK_DEVICE_EVIC_H

#define DEVICE_EVIC
#define DEVICE_ADC_MODULE_VBAT 0x12

#endif
57 changes: 57 additions & 0 deletions device/evic/src/Device.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* This file is part of eVic SDK.
*
* eVic SDK is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* eVic SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with eVic SDK. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2016 ReservedField
*/

#include <Device.h>
#include <Display.h>
#include <SysInfo.h>

Display_Type_t Device_GetDisplayType() {
switch(gSysInfo.hwVersion) {
case 102:
case 103:
case 106:
case 108:
case 109:
case 111:
return DISPLAY_SSD1327;
default:
return DISPLAY_SSD1306;
}
}

uint8_t Device_GetAtomizerShunt() {
switch(gSysInfo.hwVersion) {
case 101:
case 108:
return 125;
case 103:
case 104:
case 105:
case 106:
return 110;
case 107:
case 109:
return 120;
case 110:
case 111:
return 105;
default:
return 115;
}
}
24 changes: 24 additions & 0 deletions device/evic/src/startup.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@ This file is part of eVic SDK.
@
@ eVic SDK is free software: you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation, either version 3 of the License, or
@ (at your option) any later version.
@
@ eVic SDK is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ GNU General Public License for more details.
@
@ You should have received a copy of the GNU General Public License
@ along with eVic SDK. If not, see <http://www.gnu.org/licenses/>.
@
@ Copyright (C) 2016 ReservedField

#include <Verify.s>

.syntax unified

@ Product ID: E052
@ Max HW version: 1.11
DEVICE_INFO E052 111
27 changes: 27 additions & 0 deletions device/vtwom/Device.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is part of eVic SDK.
#
# eVic SDK is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# eVic SDK is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with eVic SDK. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2016 ReservedField

ifndef __evicsdk_make_device_vtwom_inc
__evicsdk_make_device_vtwom_inc := 1

include $(EVICSDK)/make/Device.mk

$(call add-device,vtwom, \
device/vtwom/src/Device.o, \
device/vtwom/src/startup.o)

endif # __evicsdk_make_device_vtwom_inc
26 changes: 26 additions & 0 deletions device/vtwom/include/Device.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* This file is part of eVic SDK.
*
* eVic SDK is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* eVic SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with eVic SDK. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2016 ReservedField
*/

#ifndef EVICSDK_DEVICE_VTWOM_H
#define EVICSDK_DEVICE_VTWOM_H

#define DEVICE_VTWOM
#define DEVICE_ADC_MODULE_VBAT 0x00

#endif
29 changes: 29 additions & 0 deletions device/vtwom/src/Device.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This file is part of eVic SDK.
*
* eVic SDK is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* eVic SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with eVic SDK. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2016 ReservedField
*/

#include <Device.h>
#include <Display.h>

Display_Type_t Device_GetDisplayType() {
return DISPLAY_SSD1306;
}

uint8_t Device_GetAtomizerShunt() {
return 115;
}
24 changes: 24 additions & 0 deletions device/vtwom/src/startup.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@ This file is part of eVic SDK.
@
@ eVic SDK is free software: you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation, either version 3 of the License, or
@ (at your option) any later version.
@
@ eVic SDK is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ GNU General Public License for more details.
@
@ You should have received a copy of the GNU General Public License
@ along with eVic SDK. If not, see <http://www.gnu.org/licenses/>.
@
@ Copyright (C) 2016 ReservedField

#include <Verify.s>

.syntax unified

@ Product ID: E115
@ Max HW version: 1.00
DEVICE_INFO E115 100
3 changes: 2 additions & 1 deletion include/ADC.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define EVICSDK_ADC_H

#include <stdint.h>
#include <Device.h>

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -64,7 +65,7 @@ extern "C" {
* Battery voltage module.
* The battery voltage is read through a 1/2 voltage divider.
*/
#define ADC_MODULE_VBAT 0x12
#define ADC_MODULE_VBAT DEVICE_ADC_MODULE_VBAT

/**
* Function pointer type for ADC filters.
Expand Down
48 changes: 48 additions & 0 deletions include/Device.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* This file is part of eVic SDK.
*
* eVic SDK is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* eVic SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with eVic SDK. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2016 ReservedField
*/

#ifndef EVICSDK_DEVICE_H
#define EVICSDK_DEVICE_H

#include <Display.h>

/**
* Defines:
* DEVICE_xxx: check concrete header for name.
* DEVICE_ADC_MODULE_VBAT: battery voltage ADC module.
*/

/**
* Gets the display controller type for this device.
*
* @return Display type.
*/
Display_Type_t Device_GetDisplayType();

/**
* Gets the atomizer shunt resistance.
*
* @return Shunt resistance, in 100ths of a mOhm.
*/
uint8_t Device_GetAtomizerShunt();

// Include concrete header
#include_next <Device.h>

#endif
Loading

0 comments on commit c1e7bc5

Please sign in to comment.