Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EFM32_SegmentLCD IOFuncLib mbed
main.cpp
00001 #include "mbed.h" 00002 #include "EFM32_SegmentLCD.h" 00003 #include "IOFuncLib.h" 00004 00005 00006 silabs::EFM32_SegmentLCD segmentDisplay; 00007 00008 00009 /*------------ Constant definitions --------------*/ 00010 #define TX_PIN USBTX 00011 #define RX_PIN USBRX 00012 #define BRATE 9600 00013 #define LED_PIN LED1 00014 #define TOGGLE_RATE (1.0f) 00015 #define BUFF_LENGTH 7 00016 00017 #define INIT_SECONDS 0 00018 00019 /*-------- Check if platform compatible ----------*/ 00020 #if DEVICE_SERIAL_ASYNCH 00021 Serial test_connection(USBTX, USBRX); 00022 #else 00023 #error "Platform not compatible with Low Power APIs for Serial" 00024 #endif 00025 00026 /*------------------ Variables -------------------*/ 00027 LowPowerTicker blinker; 00028 bool blinking = false; 00029 event_callback_t serialEventCb; 00030 //DigitalOut LED(LED_PIN); 00031 uint8_t rx_buf[BUFF_LENGTH + 1]; 00032 00033 volatile uint32_t seconds = INIT_SECONDS; 00034 Flasher led(LED_PIN); 00035 00036 /******************** Define Timers *****************************/ 00037 // devo separare i timers. Non so il perche' 00038 LowPowerTicker refreshTicker; 00039 /*------------------ Callbacks -------------------*/ 00040 00041 00042 //------------ Funzioni ------------- 00043 #include "Functions.h" 00044 00045 //------------------------------------- 00046 00047 00048 /*-------------------- Main ----------------------*/ 00049 int main() 00050 { 00051 /* Very Simple Main (tm) */ 00052 serialEventCb.attach(serialCb); 00053 00054 /* Setup serial connection */ 00055 test_connection.baud(BRATE); 00056 test_connection.printf("Low Power API test\n\nSend 'X' to toggle blinking\n"); 00057 test_connection.read(rx_buf, BUFF_LENGTH, serialEventCb, SERIAL_EVENT_RX_ALL, 'X'); 00058 00059 /* Let the callbacks take care of everything */ 00060 refreshTicker.attach(&tickerCallback, 1.0f); 00061 00062 while(1) sleep(); 00063 }
Generated on Thu Jul 28 2022 14:05:51 by
1.7.2