71 lines
2.4 KiB
C
71 lines
2.4 KiB
C
//=============================================================================
|
||
// S E N S I R I O N AG, Laubisruetistr. 50, CH-8712 Staefa, Switzerland
|
||
//=============================================================================
|
||
// Project : SHT3x Sample Code (V1.1)
|
||
// File : system.h (V1.1)
|
||
// Author : RFU
|
||
// Date : 6-Mai-2015
|
||
// Controller: STM32F100RB
|
||
// IDE : <20>Vision V5.12.0.0
|
||
// Compiler : Armcc
|
||
// Brief : System functions, global definitions
|
||
//=============================================================================
|
||
|
||
#ifndef SYSTEM_H
|
||
#define SYSTEM_H
|
||
|
||
//-- Includes -----------------------------------------------------------------
|
||
#include "stm32wlxx.h" // controller register definitions
|
||
#include "typedefs.h" // type definitions
|
||
|
||
#include "main.h"
|
||
|
||
|
||
//-- Enumerations -------------------------------------------------------------
|
||
// Error codes
|
||
typedef enum{
|
||
NO_ERROR = 0x00, // no error
|
||
ACK_ERROR = 0x01, // no acknowledgment error
|
||
CHECKSUM_ERROR = 0x02, // checksum mismatch error
|
||
TIMEOUT_ERROR = 0x04, // timeout error
|
||
PARM_ERROR = 0x80, // parameter out of range error
|
||
}etError;
|
||
|
||
//=============================================================================
|
||
void SystemInit(void);
|
||
//=============================================================================
|
||
// Initializes the system
|
||
//-----------------------------------------------------------------------------
|
||
|
||
//=============================================================================
|
||
void DelayMicroSeconds(u32t nbrOfUs);
|
||
//=============================================================================
|
||
// Wait function for small delays.
|
||
//-----------------------------------------------------------------------------
|
||
// input: nbrOfUs wait x times approx. one micro second (fcpu = 8MHz)
|
||
// return: -
|
||
// remark: smallest delay is approx. 15us due to function call
|
||
|
||
|
||
|
||
#define SYSTEM_CORE_CLOCK 48000000
|
||
#define DBG_TIME
|
||
#define DELAY_MS_CLOCK (SYSTEM_CORE_CLOCK - 18) / 11000
|
||
#define DELAY_100US_CLOCK (SYSTEM_CORE_CLOCK) / 120600
|
||
#define DELAY_10US_CLOCK (SYSTEM_CORE_CLOCK) / 1200000
|
||
#define DELAY_1US_CLOCK (SYSTEM_CORE_CLOCK) / 12000000
|
||
#define NOP() __ASM volatile ("nop")
|
||
|
||
|
||
void Delay(uint32_t nTime);
|
||
void DelayMs(uint32_t mS);
|
||
void Delay1Us(uint32_t time);
|
||
void Delay10Us(uint32_t time);
|
||
void Delay100Us(uint32_t time);
|
||
//void USART_Config(void);
|
||
void SysTickConfig(void);
|
||
|
||
|
||
|
||
#endif
|