Git Product home page Git Product logo

stm32-os's Introduction

stm32 OS

stm32の開発を楽にしたいという**から生まれたマルチスレッドを実現するためのOS

最終的なユーザーコード案

#include "stm32-OS.h"

struct ShareObject
{
    // スレッド全体で共有するオブジェクト
    // Atomic変数として扱われる
};

class ProcessA : public Process
{
    Mutex mutex;
    ConditionVariable sv{functionObject};
public:
    Task Setup() override
    {
        // Setup処理
    }

    Task Loop() override
    {
        // Loop処理
    }
};

class ProcessB : public Process
{
    BinarySemaphore bs;
    CountingSemaphore<3> cs;
public:
    Task Setup() override
    {
        // Setup処理
    }

    Task Loop() override
    {
        // Loop処理
    }
};

int main() 
{
    using system = System<ShareObject>; // 共有オブジェクトの設定
    
    system::setFrequency(500);//500Hz

    system::Add<A>(Args...).setPriority(Priority::High).setStackSize(1024); // スレッドの追加(優先度高、stackの量1024KB)
    system::Add<B>(); // スレッドの追加(何も書かない場合はコンストラクタの引数なし、優先度普通、stackの量は256KB)

    system.launch();
}

stm32-os's People

Contributors

naga-karupi avatar

Stargazers

OkawaYusuke avatar

Watchers

 avatar

stm32-os's Issues

Task型の実装

Task型の実装に関して全般
返り値のハンドルも定義している

`mutex`の実装

割り込みの禁止のみの予定
セマフォとかも禁止する予定だけどそもそも使うなという話であって実装するか検討中

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.