Skip to content

Commit

Permalink
added CubeCell-Module-V2 and updated printf
Browse files Browse the repository at this point in the history
  • Loading branch information
Heltec-Aaron-Lee committed Aug 30, 2022
1 parent 054ea91 commit ac5e252
Show file tree
Hide file tree
Showing 8 changed files with 1,044 additions and 313 deletions.
89 changes: 89 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,95 @@ CubeCell-Module.menu.LORAWAN_DebugLevel.2.build.LORAWAN_DebugLevel=2

###############################


CubeCell-Module-V2.name=CubeCell-Module-V2(HTCC-AM01-V2)

CubeCell-Module-V2.upload.tool=CubeCellflash
CubeCell-Module-V2.upload.maximum_size=131072
CubeCell-Module-V2.upload.maximum_data_size=131072
CubeCell-Module-V2.upload.wait_for_upload_port=true

CubeCell-Module-V2.build.board=CubeCell_Module_V2
CubeCell-Module-V2.build.core=asr650x
CubeCell-Module-V2.build.mcu=ASR6501
CubeCell-Module-V2.build.f_cpu=48000000L
CubeCell-Module-V2.build.variant=CubeCell-Module-V2

CubeCell-Module-V2.menu.LORAWAN_REGION.0=REGION_AS923(AS1)
CubeCell-Module-V2.menu.LORAWAN_REGION.0.build.band=REGION_AS923_AS1
CubeCell-Module-V2.menu.LORAWAN_REGION.1=REGION_AS923(AS2)
CubeCell-Module-V2.menu.LORAWAN_REGION.1.build.band=REGION_AS923_AS2
CubeCell-Module-V2.menu.LORAWAN_REGION.2=REGION_AU915
CubeCell-Module-V2.menu.LORAWAN_REGION.2.build.band=REGION_AU915
CubeCell-Module-V2.menu.LORAWAN_REGION.3=REGION_CN470
CubeCell-Module-V2.menu.LORAWAN_REGION.3.build.band=REGION_CN470
CubeCell-Module-V2.menu.LORAWAN_REGION.4=REGION_CN779
CubeCell-Module-V2.menu.LORAWAN_REGION.4.build.band=REGION_CN779
CubeCell-Module-V2.menu.LORAWAN_REGION.5=REGION_EU433
CubeCell-Module-V2.menu.LORAWAN_REGION.5.build.band=REGION_EU433
CubeCell-Module-V2.menu.LORAWAN_REGION.6=REGION_EU868
CubeCell-Module-V2.menu.LORAWAN_REGION.6.build.band=REGION_EU868
CubeCell-Module-V2.menu.LORAWAN_REGION.7=REGION_KR920
CubeCell-Module-V2.menu.LORAWAN_REGION.7.build.band=REGION_KR920
CubeCell-Module-V2.menu.LORAWAN_REGION.8=REGION_IN865
CubeCell-Module-V2.menu.LORAWAN_REGION.8.build.band=REGION_IN865
CubeCell-Module-V2.menu.LORAWAN_REGION.9=REGION_US915
CubeCell-Module-V2.menu.LORAWAN_REGION.9.build.band=REGION_US915
CubeCell-Module-V2.menu.LORAWAN_REGION.10=REGION_US915_HYBRID
CubeCell-Module-V2.menu.LORAWAN_REGION.10.build.band=REGION_US915_HYBRID

CubeCell-Module-V2.menu.LORAWAN_CLASS.0=CLASS_A
CubeCell-Module-V2.menu.LORAWAN_CLASS.0.build.LORAWAN_CLASS=CLASS_A
CubeCell-Module-V2.menu.LORAWAN_CLASS.2=CLASS_C
CubeCell-Module-V2.menu.LORAWAN_CLASS.2.build.LORAWAN_CLASS=CLASS_C

CubeCell-Module-V2.menu.LORAWAN_DEVEUI.0=CUSTOM
CubeCell-Module-V2.menu.LORAWAN_DEVEUI.0.build.LORAWAN_DEVEUI_AUTO=0
CubeCell-Module-V2.menu.LORAWAN_DEVEUI.1=Generate By ChipID
CubeCell-Module-V2.menu.LORAWAN_DEVEUI.1.build.LORAWAN_DEVEUI_AUTO=1

CubeCell-Module-V2.menu.LORAWAN_NETMODE.0=OTAA
CubeCell-Module-V2.menu.LORAWAN_NETMODE.0.build.LORAWAN_NETMODE=true
CubeCell-Module-V2.menu.LORAWAN_NETMODE.1=ABP
CubeCell-Module-V2.menu.LORAWAN_NETMODE.1.build.LORAWAN_NETMODE=false

CubeCell-Module-V2.menu.LORAWAN_ADR.0=ON
CubeCell-Module-V2.menu.LORAWAN_ADR.0.build.LORAWAN_ADR=true
CubeCell-Module-V2.menu.LORAWAN_ADR.1=OFF
CubeCell-Module-V2.menu.LORAWAN_ADR.1.build.LORAWAN_ADR=false

CubeCell-Module-V2.menu.LORAWAN_UPLINKMODE.0=CONFIRMED
CubeCell-Module-V2.menu.LORAWAN_UPLINKMODE.0.build.LORAWAN_UPLINKMODE=true
CubeCell-Module-V2.menu.LORAWAN_UPLINKMODE.1=UNCONFIRMED
CubeCell-Module-V2.menu.LORAWAN_UPLINKMODE.1.build.LORAWAN_UPLINKMODE=false

CubeCell-Module-V2.menu.LORAWAN_Net_Reserve.0=OFF
CubeCell-Module-V2.menu.LORAWAN_Net_Reserve.0.build.LORAWAN_Net_Reserve=false
CubeCell-Module-V2.menu.LORAWAN_Net_Reserve.1=ON
CubeCell-Module-V2.menu.LORAWAN_Net_Reserve.1.build.LORAWAN_Net_Reserve=true

CubeCell-Module-V2.menu.LORAWAN_AT_SUPPORT.0=ON
CubeCell-Module-V2.menu.LORAWAN_AT_SUPPORT.0.build.LORAWAN_AT_SUPPORT=1
CubeCell-Module-V2.menu.LORAWAN_AT_SUPPORT.1=OFF
CubeCell-Module-V2.menu.LORAWAN_AT_SUPPORT.1.build.LORAWAN_AT_SUPPORT=0

CubeCell-Module-V2.menu.LORAWAN_RGB.0=DEACTIVE
CubeCell-Module-V2.menu.LORAWAN_RGB.0.build.RGB=0

CubeCell-Module-V2.menu.LORAWAN_PREAMBLE_LENGTH.0=8(default)
CubeCell-Module-V2.menu.LORAWAN_PREAMBLE_LENGTH.0.build.LORAWAN_PREAMBLE_LENGTH=8
CubeCell-Module-V2.menu.LORAWAN_PREAMBLE_LENGTH.1=16(For M00 and M00L)
CubeCell-Module-V2.menu.LORAWAN_PREAMBLE_LENGTH.1.build.LORAWAN_PREAMBLE_LENGTH=16

CubeCell-Module-V2.menu.LORAWAN_DebugLevel.0=None
CubeCell-Module-V2.menu.LORAWAN_DebugLevel.0.build.LORAWAN_DebugLevel=0
CubeCell-Module-V2.menu.LORAWAN_DebugLevel.1=Freq
CubeCell-Module-V2.menu.LORAWAN_DebugLevel.1.build.LORAWAN_DebugLevel=1
CubeCell-Module-V2.menu.LORAWAN_DebugLevel.2=Freq && DIO
CubeCell-Module-V2.menu.LORAWAN_DebugLevel.2.build.LORAWAN_DebugLevel=2

###############################

CubeCell-BoardPlus.name=CubeCell-Board Plus(HTCC-AB02)

CubeCell-BoardPlus.upload.tool=CubeCellflash
Expand Down
15 changes: 13 additions & 2 deletions cores/asr650x/cores/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ size_t Print::write(const uint8_t *buffer, size_t size)
return n;
}

typedef void (*out_fct_type)(char character, void* buffer, size_t idx, size_t maxlen);

// internal buffer output
static inline void _out_buffer(char character, void* buffer, size_t idx, size_t maxlen)
{
if (idx < maxlen) {
((char*)buffer)[idx] = character;
}
}

extern "C" int _vsnprintf(out_fct_type out,char* buffer, const size_t maxlen, const char* format, va_list va);
size_t Print::printf(const char *format, ...)
{
char loc_buf[64];
Expand All @@ -52,15 +63,15 @@ size_t Print::printf(const char *format, ...)
va_list copy;
va_start(arg, format);
va_copy(copy, arg);
size_t len = vsnprintf(NULL, 0, format, arg);
size_t len = _vsnprintf(_out_buffer,NULL, 0, format, arg);
va_end(copy);
if(len >= sizeof(loc_buf)){
temp = new char[len+1];
if(temp == NULL) {
return 0;
}
}
len = vsnprintf(temp, len+1, format, arg);
len = _vsnprintf(_out_buffer,temp, len+1, format, arg);
write((uint8_t*)temp, len);
va_end(arg);
if(len >= sizeof(loc_buf)){
Expand Down
Loading

0 comments on commit ac5e252

Please sign in to comment.