Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable TCCs for Function Block E (4) #21

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions boards/robohatmm1/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,15 @@
#define CONFIG_TIMER_PWM_OUT6 1
#define CONFIG_TIMER_PWM_OUT6_IS_TCC
#define CONFIG_TIMER_PWM_OUT6_TC NOT_ON_TC
#define CONFIG_TIMER_PWM_OUT6_FUNC_E 1
#define CONFIG_TIMER_PWM_OUT6_TCC TCC0
#define CONFIG_TIMER_PWM_OUT6_WO 1
#define CONFIG_TIMER_PWM_OUT6_PIN 9 //PA09 - SERVO_07

#define CONFIG_TIMER_PWM_OUT7 1
#define CONFIG_TIMER_PWM_OUT7_IS_TCC
#define CONFIG_TIMER_PWM_OUT7_TC NOT_ON_TC
#define CONFIG_TIMER_PWM_OUT7_FUNC_E 1
#define CONFIG_TIMER_PWM_OUT7_TCC TCC0
#define CONFIG_TIMER_PWM_OUT7_WO 0
#define CONFIG_TIMER_PWM_OUT7_PIN 8 //PA08 - SERVO_08
Expand Down
50 changes: 50 additions & 0 deletions include/SeesawConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,56 @@
#define CONFIG_TIMER_PWM_OUT11_PIN 0
#endif

#ifdef USE_TCC_TIMERS
#ifndef CONFIG_TIMER_PWM_OUT0_FUNC_E
#define CONFIG_TIMER_PWM_OUT0_FUNC_E 0
#endif

#ifndef CONFIG_TIMER_PWM_OUT1_FUNC_E
#define CONFIG_TIMER_PWM_OUT1_FUNC_E 0
#endif

#ifndef CONFIG_TIMER_PWM_OUT2_FUNC_E
#define CONFIG_TIMER_PWM_OUT2_FUNC_E 0
#endif

#ifndef CONFIG_TIMER_PWM_OUT3_FUNC_E
#define CONFIG_TIMER_PWM_OUT3_FUNC_E 0
#endif

#ifndef CONFIG_TIMER_PWM_OUT4_FUNC_E
#define CONFIG_TIMER_PWM_OUT4_FUNC_E 0
#endif

#ifndef CONFIG_TIMER_PWM_OUT5_FUNC_E
#define CONFIG_TIMER_PWM_OUT5_FUNC_E 0
#endif

#ifndef CONFIG_TIMER_PWM_OUT6_FUNC_E
#define CONFIG_TIMER_PWM_OUT6_FUNC_E 0
#endif

#ifndef CONFIG_TIMER_PWM_OUT7_FUNC_E
#define CONFIG_TIMER_PWM_OUT7_FUNC_E 0
#endif

#ifndef CONFIG_TIMER_PWM_OUT8_FUNC_E
#define CONFIG_TIMER_PWM_OUT8_FUNC_E 0
#endif

#ifndef CONFIG_TIMER_PWM_OUT9_FUNC_E
#define CONFIG_TIMER_PWM_OUT9_FUNC_E 0
#endif

#ifndef CONFIG_TIMER_PWM_OUT10_FUNC_E
#define CONFIG_TIMER_PWM_OUT10_FUNC_E 0
#endif

#ifndef CONFIG_TIMER_PWM_OUT11_FUNC_E
#define CONFIG_TIMER_PWM_OUT11_FUNC_E 0
#endif
#endif // USE_TCC_TIMERS

#if CONFIG_TIMER
typedef struct _PWM
{
Expand Down
24 changes: 12 additions & 12 deletions source/AOTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ QState AOTimer::Stopped(AOTimer * const me, QEvt const * const e) {
#if CONFIG_TIMER_PWM_OUT0
#ifdef USE_TCC_TIMERS
#ifdef CONFIG_TIMER_PWM_OUT0_IS_TCC
if(CONFIG_TIMER_PWM_OUT0_TCC == TCC2)
if(CONFIG_TIMER_PWM_OUT0_TCC == TCC2 || CONFIG_TIMER_PWM_OUT0_FUNC_E )
pinPeripheral(CONFIG_TIMER_PWM_OUT0_PIN, 4);
else
pinPeripheral(CONFIG_TIMER_PWM_OUT0_PIN, 5);
Expand All @@ -134,7 +134,7 @@ QState AOTimer::Stopped(AOTimer * const me, QEvt const * const e) {
#if CONFIG_TIMER_PWM_OUT1
#ifdef USE_TCC_TIMERS
#ifdef CONFIG_TIMER_PWM_OUT1_IS_TCC
if(CONFIG_TIMER_PWM_OUT1_TCC == TCC2)
if(CONFIG_TIMER_PWM_OUT1_TCC == TCC2 || CONFIG_TIMER_PWM_OUT1_FUNC_E )
pinPeripheral(CONFIG_TIMER_PWM_OUT1_PIN, 4);
else
pinPeripheral(CONFIG_TIMER_PWM_OUT1_PIN, 5);
Expand All @@ -153,7 +153,7 @@ QState AOTimer::Stopped(AOTimer * const me, QEvt const * const e) {
#if CONFIG_TIMER_PWM_OUT2
#ifdef USE_TCC_TIMERS
#ifdef CONFIG_TIMER_PWM_OUT2_IS_TCC
if(CONFIG_TIMER_PWM_OUT2_TCC == TCC2)
if(CONFIG_TIMER_PWM_OUT2_TCC == TCC2 || CONFIG_TIMER_PWM_OUT2_FUNC_E )
pinPeripheral(CONFIG_TIMER_PWM_OUT2_PIN, 4);
else
pinPeripheral(CONFIG_TIMER_PWM_OUT2_PIN, 5);
Expand All @@ -172,7 +172,7 @@ QState AOTimer::Stopped(AOTimer * const me, QEvt const * const e) {
#if CONFIG_TIMER_PWM_OUT3
#ifdef USE_TCC_TIMERS
#ifdef CONFIG_TIMER_PWM_OUT3_IS_TCC
if(CONFIG_TIMER_PWM_OUT3_TCC == TCC2)
if(CONFIG_TIMER_PWM_OUT3_TCC == TCC2 || CONFIG_TIMER_PWM_OUT3_FUNC_E )
pinPeripheral(CONFIG_TIMER_PWM_OUT3_PIN, 4);
else
pinPeripheral(CONFIG_TIMER_PWM_OUT3_PIN, 5);
Expand All @@ -191,7 +191,7 @@ QState AOTimer::Stopped(AOTimer * const me, QEvt const * const e) {
#if CONFIG_TIMER_PWM_OUT4
#ifdef USE_TCC_TIMERS
#ifdef CONFIG_TIMER_PWM_OUT4_IS_TCC
if(CONFIG_TIMER_PWM_OUT4_TCC == TCC2)
if(CONFIG_TIMER_PWM_OUT4_TCC == TCC2 || CONFIG_TIMER_PWM_OUT4_FUNC_E )
pinPeripheral(CONFIG_TIMER_PWM_OUT4_PIN, 4);
else
pinPeripheral(CONFIG_TIMER_PWM_OUT4_PIN, 5);
Expand All @@ -210,7 +210,7 @@ QState AOTimer::Stopped(AOTimer * const me, QEvt const * const e) {
#if CONFIG_TIMER_PWM_OUT5
#ifdef USE_TCC_TIMERS
#ifdef CONFIG_TIMER_PWM_OUT5_IS_TCC
if(CONFIG_TIMER_PWM_OUT5_TCC == TCC2)
if(CONFIG_TIMER_PWM_OUT5_TCC == TCC2 || CONFIG_TIMER_PWM_OUT5_FUNC_E )
pinPeripheral(CONFIG_TIMER_PWM_OUT5_PIN, 4);
else
pinPeripheral(CONFIG_TIMER_PWM_OUT5_PIN, 5);
Expand All @@ -229,7 +229,7 @@ QState AOTimer::Stopped(AOTimer * const me, QEvt const * const e) {
#if CONFIG_TIMER_PWM_OUT6
#ifdef USE_TCC_TIMERS
#ifdef CONFIG_TIMER_PWM_OUT6_IS_TCC
if(CONFIG_TIMER_PWM_OUT6_TCC == TCC2)
if(CONFIG_TIMER_PWM_OUT6_TCC == TCC2 || CONFIG_TIMER_PWM_OUT6_FUNC_E )
pinPeripheral(CONFIG_TIMER_PWM_OUT6_PIN, 4);
else
pinPeripheral(CONFIG_TIMER_PWM_OUT6_PIN, 5);
Expand All @@ -248,7 +248,7 @@ QState AOTimer::Stopped(AOTimer * const me, QEvt const * const e) {
#if CONFIG_TIMER_PWM_OUT7
#ifdef USE_TCC_TIMERS
#ifdef CONFIG_TIMER_PWM_OUT7_IS_TCC
if(CONFIG_TIMER_PWM_OUT7_TCC == TCC2)
if(CONFIG_TIMER_PWM_OUT7_TCC == TCC2 || CONFIG_TIMER_PWM_OUT7_FUNC_E )
pinPeripheral(CONFIG_TIMER_PWM_OUT7_PIN, 4);
else
pinPeripheral(CONFIG_TIMER_PWM_OUT7_PIN, 5);
Expand All @@ -267,7 +267,7 @@ QState AOTimer::Stopped(AOTimer * const me, QEvt const * const e) {
#if CONFIG_TIMER_PWM_OUT8
#ifdef USE_TCC_TIMERS
#ifdef CONFIG_TIMER_PWM_OUT8_IS_TCC
if(CONFIG_TIMER_PWM_OUT8_TCC == TCC2)
if(CONFIG_TIMER_PWM_OUT8_TCC == TCC2 || CONFIG_TIMER_PWM_OUT8_FUNC_E )
pinPeripheral(CONFIG_TIMER_PWM_OUT8_PIN, 4);
else
pinPeripheral(CONFIG_TIMER_PWM_OUT8_PIN, 5);
Expand All @@ -286,7 +286,7 @@ QState AOTimer::Stopped(AOTimer * const me, QEvt const * const e) {
#if CONFIG_TIMER_PWM_OUT9
#ifdef USE_TCC_TIMERS
#ifdef CONFIG_TIMER_PWM_OUT9_IS_TCC
if(CONFIG_TIMER_PWM_OUT9_TCC == TCC2)
if(CONFIG_TIMER_PWM_OUT9_TCC == TCC2 || CONFIG_TIMER_PWM_OUT9_FUNC_E )
pinPeripheral(CONFIG_TIMER_PWM_OUT9_PIN, 4);
else
pinPeripheral(CONFIG_TIMER_PWM_OUT9_PIN, 5);
Expand All @@ -305,7 +305,7 @@ QState AOTimer::Stopped(AOTimer * const me, QEvt const * const e) {
#if CONFIG_TIMER_PWM_OUT10
#ifdef USE_TCC_TIMERS
#ifdef CONFIG_TIMER_PWM_OUT10_IS_TCC
if(CONFIG_TIMER_PWM_OUT10_TCC == TCC2)
if(CONFIG_TIMER_PWM_OUT10_TCC == TCC2 || CONFIG_TIMER_PWM_OUT10_FUNC_E )
pinPeripheral(CONFIG_TIMER_PWM_OUT10_PIN, 4);
else
pinPeripheral(CONFIG_TIMER_PWM_OUT10_PIN, 5);
Expand All @@ -324,7 +324,7 @@ QState AOTimer::Stopped(AOTimer * const me, QEvt const * const e) {
#if CONFIG_TIMER_PWM_OUT11
#ifdef USE_TCC_TIMERS
#ifdef CONFIG_TIMER_PWM_OUT11_IS_TCC
if(CONFIG_TIMER_PWM_OUT11_TCC == TCC2)
if(CONFIG_TIMER_PWM_OUT11_TCC == TCC2 || CONFIG_TIMER_PWM_OUT11_FUNC_E )
pinPeripheral(CONFIG_TIMER_PWM_OUT11_PIN, 4);
else
pinPeripheral(CONFIG_TIMER_PWM_OUT11_PIN, 5);
Expand Down