Skip to content

Commit

Permalink
move processor family related definitions from fas_common.h into file…
Browse files Browse the repository at this point in the history
…s in fas_arch/
  • Loading branch information
gin66 committed Aug 18, 2024
1 parent 93d18d8 commit 10be2a0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 52 deletions.
13 changes: 13 additions & 0 deletions src/fas_arch/arduino_esp32.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,17 @@
// have more than one core
#define SUPPORT_CPU_AFFINITY

#ifdef __ESP32_IDF_V44__
#include <driver/periph_ctrl.h>
#include <soc/periph_defs.h>
#endif /* __ESP32_IDF_V44__ */

//==========================================================================
// determine, if driver type selection should be supported
#if defined(QUEUES_MCPWM_PCNT) && defined(QUEUES_RMT)
#if (QUEUES_MCPWM_PCNT > 0) && (QUEUES_RMT > 0)
#define SUPPORT_SELECT_DRIVER_TYPE
#endif
#endif

#endif /* FAS_ARCH_ARDUINO_ESP32_H */
13 changes: 13 additions & 0 deletions src/fas_arch/espidf_esp32.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,17 @@
#define FAS_RMT_MEM(channel) ((uint32_t *)RMT_CHANNEL_MEM(channel))
#endif

#ifdef __ESP32_IDF_V44__
#include <driver/periph_ctrl.h>
#include <soc/periph_defs.h>
#endif /* __ESP32_IDF_V44__ */

//==========================================================================
// determine, if driver type selection should be supported
#if defined(QUEUES_MCPWM_PCNT) && defined(QUEUES_RMT)
#if (QUEUES_MCPWM_PCNT > 0) && (QUEUES_RMT > 0)
#define SUPPORT_SELECT_DRIVER_TYPE
#endif
#endif

#endif /* FAS_ARCH_ESPIDF_ESP32_H */
63 changes: 11 additions & 52 deletions src/fas_common.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef COMMON_H
#define COMMON_H
#ifndef FAS_COMMON_H
#define FAS_COMMON_H

#define TICKS_FOR_STOPPED_MOTOR 0xffffffff

Expand Down Expand Up @@ -60,75 +60,34 @@ struct queue_end_s {
// All architecture specific definitions should be located here
//==============================================================================

// disable inject_fill_interrupt() for all real devices
#ifndef TEST
#define inject_fill_interrupt(x)
#endif

//==========================================================================
//
// The TEST "architecture" is in use with pc_based testing.
//
//
//==========================================================================
#if defined(TEST)
// TEST "architecture" is in use with pc_based testing.
#include "fas_arch/test_pc.h"

//==========================================================================
//
// This for ESP32 derivates using arduino core
//
//==========================================================================
#elif defined(ARDUINO_ARCH_ESP32)
// ESP32 derivates using arduino core
#include "fas_arch/arduino_esp32.h"

//==========================================================================
//
// This for ESP32 derivates using espidf
//
// This is most likely broken and not tested on github actions
//
//==========================================================================
#elif defined(ESP_PLATFORM)
// ESP32 derivates using espidf
#include "fas_arch/espidf_esp32.h"

//==========================================================================
//
// This for SAM-architecture
//
//==========================================================================
#elif defined(ARDUINO_ARCH_SAM)
// SAM-architecture
#include "fas_arch/arduino_sam.h"

//==========================================================================
//
// This for the AVR family
//
//==========================================================================
#elif defined(ARDUINO_ARCH_AVR)
// AVR family
#include "fas_arch/arduino_avr.h"

//==========================================================================
//
// For all unsupported devices
//
//==========================================================================
#else
#error "Unsupported devices"

#endif

#ifdef __ESP32_IDF_V44__
#include <driver/periph_ctrl.h>
#include <soc/periph_defs.h>
#endif /* __ESP32_IDF_V44__ */

//==========================================================================
// determine, if driver type selection should be supported
#if defined(QUEUES_MCPWM_PCNT) && defined(QUEUES_RMT)
#if (QUEUES_MCPWM_PCNT > 0) && (QUEUES_RMT > 0)
#define SUPPORT_SELECT_DRIVER_TYPE
#endif
// disable inject_fill_interrupt() for all real devices. Only defined in TEST
#ifndef inject_fill_interrupt
#define inject_fill_interrupt(x)
#endif

#endif /* COMMON_H */
#endif /* FAS_COMMON_H */

0 comments on commit 10be2a0

Please sign in to comment.