Skip to content

Instantly share code, notes, and snippets.

View chipsoft's full-sized avatar
🎯
Focusing

Denys Suprunenko chipsoft

🎯
Focusing
View GitHub Profile
@chipsoft
chipsoft / vPortSuppressTicksAndSleep.c
Last active August 27, 2025 14:42
vPortSuppressTicksAndSleep implementation example
/* Tickless idle using RTC and STOP2 for long delays, WFI for short delays */
void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
{
if (xExpectedIdleTime == 0) {
return;
}
const TickType_t ticksPerSecond = configTICK_RATE_HZ;
const TickType_t STOP2_THRESHOLD = pdMS_TO_TICKS(2000); /* 2s minimum for STOP2 */
@chipsoft
chipsoft / debug_color.h
Last active August 19, 2025 07:52
Console definition for colour text
#ifndef _DEBUG_COLOR_H_
#define _DEBUG_COLOR_H_
#define TTY_COLOR_YELLOW "\033[1;33m"
#define TTY_COLOR_GREEN "\033[1;32m"
#define TTY_COLOR_RED "\033[1;31m"
#define TTY_COLOR_RESET "\033[0m"
#define TTY_COLOR_DEF "\033[0;39m"
#define TTY_COLOR_BLUE "\033[1;34m"
#define TTY_COLOR_CYAN "\033[1;36m"
@chipsoft
chipsoft / hard_fault.c
Created June 25, 2025 16:47
HardFault interrupt handler
/*
* MIT License
*
* Copyright (c) 2025 Denys Suprunenko chipsoft@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is