Mbed OS: Rozdiel medzi revíziami
Zo stránky SensorWiki
Bez shrnutí editace |
|||
Riadok 38: | Riadok 38: | ||
'''Velmi dobry''' zoznam k nejakemu kurzu je tu: https://os.mbed.com/teams/TVZ-Mechatronics-Team/wiki/Homepage | '''Velmi dobry''' zoznam k nejakemu kurzu je tu: https://os.mbed.com/teams/TVZ-Mechatronics-Team/wiki/Homepage | ||
* Course notes aj so slajdami https://os.mbed.com/cookbook/Course-Notes | |||
* Kucharska kniha: https://os.mbed.com/cookbook/Homepage | |||
* [https://os.mbed.com/users/4180_1/notebook/pushbuttons/ Pushbuttons and switches] | * [https://os.mbed.com/users/4180_1/notebook/pushbuttons/ Pushbuttons and switches] |
Verzia z 13:00, 2. máj 2022
mbed je jednak počítačová platforma na báze procesorov ARM Cortex-M a jednak rovnomenný operačný systém určený pre túto platformu. Operační systém mbed je napísaný v kombinácii C a C++ a je uvolnený pod licenciou Apache License. Jeho vývoj koordinuje firma ARM Holdings, ktorá celú platformu inzeruje ako základ pre tvorbu aplikácií pre IoT.
Medzi podporný software napísaný priamo pre mbed patrí integrované vývojové prostredie implementované ako webová aplikácia, ktorá běží priamo v prehliadači. Okrem toho pre túto platformu existujú aj iné vývojové prostredia a kompilátory, napr. Eclipse doplnené o príslušnú variantu GCC alebo Yotta.
- https://os.mbed.com/mbed-os/ Main page
- https://en.wikipedia.org/wiki/Mbed Overview
- https://www.arm.com/products/development-tools/embedded-and-software/mbed-os ARM product page
- https://youtu.be/BsV-5IFaOLg What is Mbed OS? (video)
- https://os.mbed.com/docs/mbed-os/v6.15/apis/security-concepts.html Mbed security concepts
Všeobecný text o tom, čo je to Embedded OS spolu s prehladom (FreeRTOS, mbedOS, Embedded Linux, Windows...) je tuto
https://community.element14.com/learn/learning-center/essentials/w/documents/4762/embedded-software-i-embedded-os?ICID=essentials-embedsoftware2-doc?param=prev
Hardware
- https://os.mbed.com/handbook/mbed-Microcontrollers Mbed official microcontroller boards
- micro:bit
- STM Nucleo boards
- RPi pico - experimental support: https://github.com/arduino/ArduinoCore-mbed/releases/tag/2.0.0
- List of supported HW: https://os.mbed.com/platforms/
- Pozor na fake chipy:
Simulátor
Príklady
Zoznam príkladov a návodov, ktoré by sa dali využiť a testovať na micro:bit alebo iný vhodný dev Kit.
Velmi dobry zoznam k nejakemu kurzu je tu: https://os.mbed.com/teams/TVZ-Mechatronics-Team/wiki/Homepage
- Course notes aj so slajdami https://os.mbed.com/cookbook/Course-Notes
- Kucharska kniha: https://os.mbed.com/cookbook/Homepage
- https://os.mbed.com/users/4180_1/notebook/cc-io-register-names/
- https://os.mbed.com/users/4180_1/notebook/using-the-hc-sr04-sonar-sensor/ (zaroven aj Timer!)
- Analog In https://os.mbed.com/docs/mbed-os/v5.15/apis/analogin.html (a asi aj serial printf?)
- Serial https://os.mbed.com/handbook/Serial (software serial?)
- Blocking and non-blocking Serial input https://os.mbed.com/questions/80004/How-to-read-and-write-serial-data/
micro:bit specific
- https://os.mbed.com/platforms/Microbit/#micro-bit-device-abstraction-layer-dal
- https://lancaster-university.github.io/microbit-docs/ubit/io/
/* Zakladne blikanie LEDkou na micro:bite
*
* Prvy sposob nevyzaduje specialnu micro:bit kniznicu, staci mbed.h a vybrany prislusny hardware. Z neho je uz jasne,
* ako sa ma co prelozit, len treba pouzivat originalne nazvy pinov P0_x
*
* Druhy sposob vyzaduje MicroBit.h a je tam zjednodusene volanie, ale zasa sa asi nedostaneme az priamo ku HW.
* Podstatne je, ze oba sposoby funguju ALE! nesmu sa kombinovat, potom mi tam nieco preblikava naviac.
* 4.2.2022
*
* Kompletna dokumentacia k MicroBit.h je tu https://lancaster-university.github.io/microbit-docs/ubit/io/
*/
#include "mbed.h"
#include "MicroBit.h"
#define Row2 P0_14
#define Col3 P0_6
/* len mbed.h */
DigitalOut row2(P0_14); // priama definicia
DigitalOut col(Col3); // detto s vyuzitim pseudopremennej Col3
/* len MicroBit.h */
MicroBit uBit;
int main()
{
while(1) {
/* len mbed.h */
/* row2 = 1;
col = 0;
wait(0.25);
row2 = 0;
col = 0;
wait(0.25);
*/
/* len MicroBit.h */
uBit.display.image.setPixelValue(2,2,127); // treti parameter <0-255>
wait(0.25);
uBit.display.image.setPixelValue(2,2,0);
wait(0.25);
}
}
No a toto je priklad, ktory som nasiel na disku pod nazvom armCourse02, ale uz si nepamatam ci to fungovalo a co to malo robit, treba to preverit
#include "mbed.h"
#define BUTTON_1 p5
#define BUTTON_2 p6
#define BUTTON_3 p7
#define BUTTON_4 p8
#define RED_LED p9
#define YEL_LED p10
#define BLU_LED p11
K tomuto poznamka pre micro:bit (ostatne platformy by mali byt ovela jasnejsie vraj):
//#defines for each edge connector pin
#define MICROBIT_PIN_P0 P0_3 //P0 is the left most pad (ANALOG/DIGITAL) used to be P0_3 on green board
#define MICROBIT_PIN_P1 P0_2 //P1 is the middle pad (ANALOG/DIGITAL)
#define MICROBIT_PIN_P2 P0_1 //P2 is the right most pad (ANALOG/DIGITAL) used to be P0_1 on green board
#define MICROBIT_PIN_P3 P0_4 //COL1 (ANALOG/DIGITAL)
#define MICROBIT_PIN_P4 P0_5 //COL2 (ANALOG/DIGITAL)
#define MICROBIT_PIN_P5 P0_17 //BTN_A
#define MICROBIT_PIN_P6 P0_12 //COL9
#define MICROBIT_PIN_P7 P0_11 //COL8
#define MICROBIT_PIN_P8 P0_18 //PIN 18
#define MICROBIT_PIN_P9 P0_10 //COL7
#define MICROBIT_PIN_P10 P0_6 //COL3 (ANALOG/DIGITAL)
#define MICROBIT_PIN_P11 P0_26 //BTN_B
#define MICROBIT_PIN_P12 P0_20 //PIN 20
#define MICROBIT_PIN_P13 P0_23 //SCK
#define MICROBIT_PIN_P14 P0_22 //MISO
#define MICROBIT_PIN_P15 P0_21 //MOSI
#define MICROBIT_PIN_P16 P0_16 //PIN 16
#define MICROBIT_PIN_P19 P0_0 //SCL
#define MICROBIT_PIN_P20 P0_30 //SDA
DigitalIn b1(BUTTON_1);
DigitalIn b2(BUTTON_2);
DigitalIn b3(BUTTON_3);
DigitalIn b4(BUTTON_4);
DigitalOut rled(RED_LED);
DigitalOut yled(YEL_LED);
DigitalOut bled(BLU_LED);
BusIn buttonbus(BUTTON_1,BUTTON_2,BUTTON_3,BUTTON_4);
BusOut ledsbus (RED_LED,YEL_LED,BLU_LED);
void ControlLED_DigitalIO ();
void ControlLED_BusIO ();
int main()
{
while(1)
{
// ControlLED_DigitalIO ();
ControlLED_BusIO ();
wait(0.25);
}
}
void ControlLED_DigitalIO ()
{
rled = !b4&&b3;
yled = 1;
bled = b4;
}
void ControlLED_BusIO ()
{
switch(buttonbus)
{
case 0 ... 3:
ledsbus = 0b0100;
break;
case 4 ... 14:
ledsbus = 0b0111;
break;
case 15:
ledsbus = 0b0000;
break;
default:
break;
}
}