Skip to content

Commit d6e0fc3

Browse files
committed
Merge branch 'gingerbread-cupcake'
Conflicts: src/libsc/k60/ab_encoder.cpp src/libsc/k60/dir_encoder.cpp
2 parents 4940433 + 3818a01 commit d6e0fc3

File tree

223 files changed

+7474
-1572
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+7474
-1572
lines changed

MakeConfig.inc

100755100644
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ CPPFLAGS+=-DK60_2014_INNO=1
2222
SCCC_MCU=MK60DZ10
2323
$(info Config = 2014_INNO)
2424

25+
else ifeq ($(SCCC_CONFIG),2014_INNO_FX)
26+
BIN_SUFFIX:=$(BIN_SUFFIX)-2014-inno-fx
27+
CPPFLAGS+=-DK60_2014_INNO=1
28+
SCCC_MCU=MK60F15
29+
$(info Config = 2014_INNO_FX)
30+
2531
else ifeq ($(SCCC_CONFIG),2014_MAGNETIC)
2632
BIN_SUFFIX:=$(BIN_SUFFIX)-2014-magnetic
2733
CPPFLAGS+=-DK60_2014_MAGNETIC=1
@@ -34,6 +40,18 @@ CPPFLAGS+=-DK60_VCAN_FX15DEV=1
3440
SCCC_MCU=MK60F15
3541
$(info Config = VCAN_FX15DEV)
3642

43+
else ifeq ($(SCCC_CONFIG),2015_CAMERA)
44+
BIN_SUFFIX:=$(BIN_SUFFIX)-2015-camera
45+
CPPFLAGS+=-DK60_2015_CAMERA=1
46+
SCCC_MCU=MK60F15
47+
$(info Config = 2015_CAMERA)
48+
49+
else ifeq ($(SCCC_CONFIG),2015_MAGNETIC)
50+
BIN_SUFFIX:=$(BIN_SUFFIX)-2015-magnetic
51+
CPPFLAGS+=-DK60_2015_MAGNETIC=1
52+
SCCC_MCU=MK60F15
53+
$(info Config = 2015_MAGNETIC)
54+
3755
else
3856
$(error Missing/Unknown config '$(SCCC_CONFIG)' (set SCCC_CONFIG))
3957

Makefile

100755100644
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ OUT_OBJ_PATH=obj
77
TOOLCHAIN_PREFIX=arm-none-eabi-
88
CC=$(TOOLCHAIN_PREFIX)gcc
99
CXX=$(TOOLCHAIN_PREFIX)g++
10-
AR=$(TOOLCHAIN_PREFIX)ar
10+
AR=$(TOOLCHAIN_PREFIX)gcc-ar
1111

1212
# Additional include dirs
1313
ALL_INC_PATHS=$(INC_PATH) $(SRC_PATH)
@@ -35,6 +35,14 @@ $(info Make version = $(MAKE_VERSION))
3535

3636
endif
3737

38+
ifdef WIN32
39+
# TODO Also print CC version on win32
40+
41+
else ifdef UNIX
42+
$(info CC = $(shell $(CC) --version | (read -r line; echo $$line)))
43+
44+
endif
45+
3846
$(info User include paths = $(ALL_INC_PATHS))
3947
$(info User symbols = $(ALL_SYMBOLS))
4048

@@ -53,6 +61,8 @@ CCFLAGS+=-fmessage-length=0
5361
CCFLAGS+=-flto -ffunction-sections -fdata-sections
5462
CCFLAGS+=-fno-strict-aliasing
5563
CCFLAGS+=-Wall -Wextra
64+
# Wmissing-field-initializers is causing too much false warnings
65+
CCFLAGS+=-Wno-missing-field-initializers
5666

5767
ifeq ($(SCCC_BUILD),DEBUG)
5868
BIN_SUFFIX:=$(BIN_SUFFIX)-d

inc/libbase/cmsis/core_cm4.h

100755100644
File mode changed.

inc/libbase/cmsis/core_cm4_simd.h

100755100644
File mode changed.

inc/libbase/cmsis/core_cmFunc.h

100755100644
File mode changed.

inc/libbase/cmsis/core_cmInstr.h

100755100644
File mode changed.

inc/libbase/k60/adc.h

100755100644
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include <functional>
1515

16+
#include "libbase/k60/dma.h"
1617
#include "libbase/k60/misc_utils.h"
1718
#include "libbase/k60/pin.h"
1819
#include "libbase/k60/pinout_macros.h"
@@ -123,7 +124,7 @@ class Adc
123124
* @note Having listener and continuous mode both set will most likely
124125
* result in the listener being called in a dead lock manner
125126
*/
126-
OnConversionCompleteListener conversion_listener;
127+
OnConversionCompleteListener conversion_isr;
127128
};
128129

129130
static constexpr int kModuleChannelCount = 36;
@@ -183,6 +184,19 @@ class Adc
183184
m_config.avg_pass = avg_pass;
184185
}
185186

187+
/**
188+
* Config this Adc up to be ready to serve conversion result as DMA source,
189+
* and set @a config accordingly. The following options are also set besides
190+
* mux_src and src:<br>
191+
* Dma::Config::minor_bytes = 1 or 2 (depending on the resolution)
192+
*
193+
* @note To use DMA, Config::conversion_isr must NOT be set for this Adc.
194+
* Otherwise, the operation will fail and no changes would be made to
195+
* @a config
196+
* @param config
197+
*/
198+
void ConfigResultAsDmaSrc(Dma::Config *config);
199+
186200
private:
187201
bool InitModule(const Pin::Name pin);
188202
bool InitModule(const Adc::Name adc);

inc/libbase/k60/adc_utils.h

100755100644
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ namespace k60
2121
class AdcUtils
2222
{
2323
public:
24-
static Uint GetModule(const Adc::Name pin)
24+
static Uint GetModule(const Adc::Name adc)
2525
{
26-
return static_cast<Uint>(pin) / Adc::kModuleChannelCount;
26+
return static_cast<Uint>(adc) / Adc::kModuleChannelCount;
2727
}
2828

29-
static Uint GetChannel(const Adc::Name pin)
29+
static Uint GetChannel(const Adc::Name adc)
3030
{
31-
return static_cast<Uint>(pin) % Adc::kModuleChannelCount;
31+
return static_cast<Uint>(adc) % Adc::kModuleChannelCount;
3232
}
3333

34-
static Uint GetChannelNumber(const Adc::Name pin)
34+
static Uint GetChannelNumber(const Adc::Name adc)
3535
{
36-
const Uint channel = GetChannel(pin);
36+
const Uint channel = GetChannel(adc);
3737
if (channel >= (Uint)Adc::Name::kAdc0Ad4B)
3838
{
3939
return channel - 4;

inc/libbase/k60/cache.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* cache.h
3+
*
4+
* Author: Ming Tsang
5+
* Copyright (c) 2014-2015 HKUST SmartCar Team
6+
* Refer to LICENSE for details
7+
*/
8+
9+
#pragma once
10+
11+
namespace libbase
12+
{
13+
namespace k60
14+
{
15+
16+
class Cache
17+
{
18+
public:
19+
struct Config
20+
{
21+
bool is_enable;
22+
};
23+
24+
static Cache& Get()
25+
{
26+
static Cache inst;
27+
return inst;
28+
}
29+
30+
void Init(const Config &config);
31+
32+
private:
33+
Cache();
34+
35+
void InitPc();
36+
void InitPs();
37+
38+
bool m_is_init;
39+
};
40+
41+
}
42+
}

inc/libbase/k60/clock_utils.h

100755100644
File mode changed.

0 commit comments

Comments
 (0)