Comments (3)
Communication / Command Processing
In our avr prototype, we use a homemade circular buffer to group commands before processing.
- https://github.com/leka/LKAlphaOS-avr/blob/develop/lib/Buffer/Buffer.h
- https://github.com/leka/LKAlphaOS-avr/blob/develop/lib/Buffer/Buffer.cpp
mbed provides something similar with built-in critical sections lock so it can be used from ISR (if needed).
https://os.mbed.com/docs/mbed-os/v5.14/apis/circularbuffer.html
Both have push/write
, pop/read
, peek/peek
and status functions.
Our buffer also has a hasPattern
function to look for specific patterns inside the buffer, e.g. the start sequence
(https://github.com/leka/LKAlphaComSpecs/#start-sequence)
https://github.com/leka/LKAlphaOS-avr/blob/develop/lib/Buffer/Buffer.cpp#L153
from lekaos.
Thread synchronization with EventFlags
I haven't tested it, but EventFlags could be a very nice tool to synchronize our threads with the wait_any
function:
For LED animation, something like this could work, we need to try it out:
// inside a thread function doing the animation
while(true) {
// ...
leds.shine(200, 34, 78);
if event_flags.wait_any(STOP_FLAG, 10/*ms to wait*/) != 0 {
break; // break from while loop
}
leds.shine(150, 34, 90);
// ...
}
The same tool can be used to "start" threads.
signal_wait
should also be explored:
from lekaos.
Simplify your code with mbed-events
from lekaos.
Related Issues (20)
- [Task] - ♻️ (BehaviorKit) - Separate bleConnection into bleConnectionWithVideo and bleConnectionWithoutVideo
- 🐛 RobotController - Working face in idle state on disconnection HOT 1
- ✅ (file): Add functional tests inspired from unit tests HOT 1
- ⚡️ (video): Get performances of video
- ⚡️ (ble): Use other types than uint8_t for Characteristics
- ♻️ (filemanager): create directory in non existant directory
- ✨ (charge): Robot helps to charge itself using IMU HOT 1
- Weekly Dev - 2023/02/07 (W06)
- [Task] - Create StorageKit
- [Task] - Review CMake target link with mbed-os almost everywhere
- Fix unexpected stop of charge HOT 1
- Weekly Dev - 2023/02/21 (W08)
- ✨ Put robot on charge using IMUKit and CoreMotor
- 🐛 Robot does not go to sleep from Autonomous Activities HOT 1
- Weekly Dev - 2023/03/02 (W09)
- 🐛 [Bug] - Robot crashes when working with Autonomous Activities
- [Story] - Review cores, kits public and private dependencies
- Weekly Dev - 2023/03/07 (W10)
- :bug: [Bug] - Fix initialization order in RobotController
- Weekly Dev - 2023/03/14 (W11)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lekaos.