sarmfsw: SMFSW Toolbox (for ARM & compatible with Arduino platform) 3.7
SMFSW collection of miscellaneous functions & macros (for ARM & compatible with Arduino platform)
Loading...
Searching...
No Matches
arm_chip_sam.h File Reference

ARM common macros for Atmel SAM families. More...

#include "atmel_start_pins.h"
#include "err_codes.h"
#include "hpl_reset.h"
#include <ARM_CMSIS_INC>
Include dependency graph for arm_chip_sam.h:

Macros

#define SAM_HEADER(f)   XCAT(<hri_, f).h>
 concatenate <hri_(f).h> name following sam family f
 
#define SAM_CONF_HEADER(f)   <sam.h>
 <sam.h> name following sam family f
 
#define ARM_CMSIS_INC   SAM_HEADER(SAM_FAMILY)
 Alias for SAM CMSIS include.
 
#define ARM_HAL_CFG   SAM_CONF_HEADER(SAM_FAMILY)
 Alias for SAM HAL config include.
 
#define HAL_MAX_TICKS   ((uint32_t) -1)
 HAL max Ticks value.
 
#define HAL_MS_TICKS_FACTOR   1
 HAL milliseconds multiplier (depending tick counter frequency)
 

Typedefs

typedef enum eResetSource eResetSource
 

Enumerations

enum  eResetSource {
  RST_POR = RESET_REASON_POR , RST_BODCORE = RESET_REASON_BODCORE , RST_BODVDD = RESET_REASON_BODVDD , RST_EXT = RESET_REASON_EXT ,
  RST_WDT = RESET_REASON_WDT , RST_SYST = RESET_REASON_SYST , RST_UNKNOWN = 0xFF
}
 Source of last reset. More...
 

Detailed Description

ARM common macros for Atmel SAM families.

Author
SMFSW
Warning
Do not use macros for function qualifiers in this file
Attention
On SAM families you should configure a timer to count for ms. A TIM peripheral shall be configured in ATMEL START (with a period of 1ms). Using driver examples from ATMEL START generated code, you can add this code to your projects.
static struct timer_task TIMER_0_task1;
static volatile uint32_t uwTick = 0;
uint32_t HAL_GetTick(void) { // Declare HALTicks() at project level if you're using a different getter function name
return uwTick; }
static void TIMER_0_task1_cb(const struct timer_task *const timer_task) {
uwTick++; }
void TIMER_0_start(void) // Adapt function if TIM configured is not TIMER_0
{
TIMER_0_task1.interval = 1; // Adjust interval if TIM period is faster than 1ms (or define appropriate HAL_MS_TICKS_FACTOR)
TIMER_0_task1.cb = TIMER_0_task1_cb;
TIMER_0_task1.mode = TIMER_TASK_REPEAT;
timer_add_task(&TIMER_0, &TIMER_0_task1);
timer_start(&TIMER_0);
}

Please note TIMER_0_start() shall be called at init.

Macro Definition Documentation

◆ ARM_CMSIS_INC

#define ARM_CMSIS_INC   SAM_HEADER(SAM_FAMILY)

Alias for SAM CMSIS include.

◆ ARM_HAL_CFG

#define ARM_HAL_CFG   SAM_CONF_HEADER(SAM_FAMILY)

Alias for SAM HAL config include.

◆ HAL_MAX_TICKS

#define HAL_MAX_TICKS   ((uint32_t) -1)

HAL max Ticks value.

Note
Define HAL_MAX_TICKS with custom max value in project if tick max value is not using 32b variable full scale

◆ HAL_MS_TICKS_FACTOR

#define HAL_MS_TICKS_FACTOR   1

HAL milliseconds multiplier (depending tick counter frequency)

Note
Define HAL_MS_TICKS_FACTOR with custom multiplier in project if tick period is not 1ms

◆ SAM_CONF_HEADER

#define SAM_CONF_HEADER ( f)    <sam.h>

<sam.h> name following sam family f

◆ SAM_HEADER

#define SAM_HEADER ( f)    XCAT(<hri_, f).h>

concatenate <hri_(f).h> name following sam family f

Typedef Documentation

◆ eResetSource

typedef enum eResetSource eResetSource

Enumeration Type Documentation

◆ eResetSource

Source of last reset.

Enumerator
RST_POR 

Power On Reset.

RST_BODCORE 

Brown Out Reset.

RST_BODVDD 
RST_EXT 

Pin Reset (External Reset)

RST_WDT 

Watchdog Reset.

RST_SYST 

Software Reset.

RST_UNKNOWN 

Unknown Reset Source.