Several examples run on only mbed-os5.13.0 (not 5.14.0)
Dependencies: BD_SD_DISCO_F769NI BSP_DISCO_F769NI LCD_DISCO_F769NI TS_DISCO_F769NI USBHost_F769NI
Nioi_main_copy1.cpp
- Committer:
- kenjiArai
- Date:
- 2019-08-07
- Revision:
- 3:35ac9ee7d2d6
File content as of revision 3:35ac9ee7d2d6:
/* * Mbed Application program / Nioi Sensor * * Created: July 28th, 2019 * Revised: August 1st, 2019 */ //#include "select_program.h" #ifdef NIOI_SENSOR // Include -------------------------------------------------------------------- #include <stdlib.h> #include <stdlib.h> #include <stdio.h> #include <string> #include <errno.h> #include "mbed.h" #include "stm32f769i_discovery.h" #include "stm32f769i_discovery_audio.h" #include "EthernetInterface.h" #include "TCPServer.h" #include "TCPSocket.h" #include "TS_DISCO_F769NI.h" #include "LCD_DISCO_F769NI.h" #include "USBHostMSD.h" #include "FATFileSystem.h" #include "SDBlockDeviceDISCOF769NI.h" #include "mon.h" #include "button_group.hpp" // Definition ----------------------------------------------------------------- using namespace Mikami; #define LEDON 1 #define LEDOFF 0 #define FOREVER 0x7fffffff #define DEBUG 0 #if DEBUG #define DBG(...) pc.printf(__VA_ARGS__) #else #define DBG(...) {;} #endif struct PointF { PointF() {} PointF(float x0, float y0) : x(x0), y(y0) {} float x, y; }; // Constructor ---------------------------------------------------------------- LCD_DISCO_F769NI lcd; TS_DISCO_F769NI ts; Serial pc(SERIAL_TX, SERIAL_RX, 115200); DigitalIn userSW(BUTTON1); DigitalOut led_red(LED1); DigitalOut led_green0(LED2); DigitalOut led_green1(LED3); SDBlockDeviceDISCOF769NI bd; FATFileSystem fs("fs"); USBHostMSD msd; // RAM ------------------------------------------------------------------------ bool flag_opening_done = false; // ROM / Constant data -------------------------------------------------------- const int X0 = 0; // origin of x axis const int Y0 = 0; // origin of y axis const int NX = 670; // number of pixels for horizon const int NY = 542; // number of pixels for vertical // Function prototypes -------------------------------------------------------- static void tsk_0(void const *args); static void tsk_1(void const *args); static void tsk_2(void const *args); static void tsk_3(void const *args); //extern void time_enter_mode(void); static void goto_standby(void); //extern void drawImage(const char * name, uint16_t x, uint16_t y); extern void draw_bitmap(uint8_t *Name_BMP, uint32_t Xpos, uint32_t Ypos); extern void task_opening_action(void const *args); //------------------------------------------------------------------------------ // Control Program //------------------------------------------------------------------------------ osThreadDef(task_opening_action, osPriorityNormal,4096); osThreadDef(tsk_1, osPriorityNormal,4096); osThreadDef(tsk_2, osPriorityNormal,4096); osThreadDef(tsk_3, osPriorityNormal,4096); int main() { flag_opening_done = false; osThreadId id0, id1, id2, id3; DBG("line:%d\r\n", __LINE__); id0 = osThreadCreate(osThread(task_opening_action), NULL); while (flag_opening_done == false) { DBG("line:%d\r\n", __LINE__); ThisThread::sleep_for(100); } osThreadTerminate(id0); // id1 = osThreadCreate(osThread(tsk_1), NULL); id2 = osThreadCreate(osThread(tsk_2), NULL); id3 = osThreadCreate(osThread(tsk_3), NULL); pc.printf("id0=0x%x, id1=0x%x, id2=0x%x, id3=0x%x\r\n", (uint32_t)id0, (uint32_t)id1, (uint32_t)id2, (uint32_t)id3); while(true) { ThisThread::sleep_for(FOREVER); } } void tsk_1(void const *args) { while(true) { led_red = LEDON; ThisThread::sleep_for(1000); led_red = LEDOFF; ThisThread::sleep_for(1000); } } void tsk_2(void const *args) { while(true) { led_green0 = LEDON; ThisThread::sleep_for(1500); led_green0 = LEDOFF; ThisThread::sleep_for(1500); } } void tsk_3(void const *args) { while(true) { led_green1 = LEDON; ThisThread::sleep_for(2000); led_green1 = LEDOFF; ThisThread::sleep_for(2000); } } void goto_standby(void) { ThisThread::sleep_for(0x7fffffff); // sleep 24 days } #endif