void Uart_Init(UartConfig_t const * const Config); void Uart_BaudRateSet(UartChannel_t const Channel, UartConfig_t const * const Config); uint8_t Uart_CharGet(UartChannel_t const Channel); void Uart_CharPut(UartChannel_t const Channel, char const Ch); uint8_t Uart_IsDataPresent(UartChannel_t const Channel); void Uart_RegisterWrite(uint32_t const Address, uint32_t...
Read More >>>Blog Archives
RTOSDelay
VTaskDelay(1);
Read More >>>TimedDelay
TimeStart = SysTick_Get(); do { TimeNow = SysTick_Get(); TimeDelta = TimeNow – TimeStart; }while(TimeDelta < DelayTime);
Read More >>>TimedDelay2
Timer_Reload(DELAY_VALUE); while(Timer_Expired() == false) { __NOP(); }
Read More >>>DelayLoop
for(int i = 0; i < 100000; i++) { __NOP(); }
Read More >>>StackGuard_Figure2
void main(void) { uint32_t * GuardPtr = (uint32_t*) GUARD_START; for(int Index=0; Index < GUARD_SIZE; Index++) { if(*GuardPtr == 0xC0DE) { // Do Nothing or signal OK } else { // Flag error! Attempt recovery ......
Read More >>>StackGuard_Figure1
GUARD_SIZE = DEFINED(__guard_size__) __guard_size__:0x00000100; .guard: { .=ALIGN(8); FILL(0xC0DE); .+=GUARD_SIZE-1; BYTE(0xE) }>m_data
Read More >>>assert_Figure4
FileReader = fopen("UserData.cfg", 'r'); assert(FileReader != NULL);
Read More >>>assert_Figure3
/* Precondition: State should be less than maximum * Postcondition: SystemState */ SystemState_t System_StateSet(SystemState_t State) { assert(State < SYSTEM_STATE_MAX); SystemState = State; assert(SystemState < SYSTEM_STATE_MAX); return SystemState; }
Read More >>>assert_Figure2
/* Precondition: State should be less than maximum */ void System_StateSet(SystemState_t State) { assert(State < SYSTEM_STATE_MAX); SystemState = State; }
Read More >>>SafetyFirmwareI2C
Example infinite loop taken from I2C on a safety microcontroller Continue reading
Read More >>>ITM_SendData
__STATIC_INLINE uint32_t ITM_SendData (uint8_t Channel, uint32_t Data, uint8_t DataSizeInBytes) { assert(Channel < 32); assert(DataSizeInBytes <= 4); /* 1, 2, 4 are valid */ assert((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL); /* ITM enabled */ assert((ITM->TER & (1UL...
Read More >>>