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.
main.cpp
00001 #include "mbed.h" 00002 #include "flashwrapper.h" 00003 00004 int main() 00005 { 00006 typedef struct 00007 { 00008 float a; 00009 uint32_t b; 00010 uint16_t c; 00011 uint8_t d; 00012 }bab_t; 00013 00014 char q=sizeof(bab_t)/sizeof(uint32_t); 00015 typedef union { 00016 bab_t a; 00017 uint32_t b[sizeof(bab_t)/sizeof(uint32_t)/*+другие структуры так же*/]; 00018 }RW_t; 00019 00020 RW_t bufer; 00021 00022 bufer.a.a=0.67; 00023 bufer.a.b=5000000; 00024 bufer.a.c=60000; 00025 bufer.a.d=150; 00026 00027 flashWrite(0,bufer.b,q); 00028 for(int i=0;i<q;i++) 00029 {bufer.b[i]=flashRead(i*4);} 00030 00031 printf("Value = %f\r\n",bufer.a.a); 00032 printf("Value = %d\r\n",bufer.a.b); 00033 printf("Value = %d\r\n",bufer.a.c); 00034 printf("Value = %d\r\n",bufer.a.d); 00035 00036 00037 }
Generated on Sat Aug 20 2022 18:49:11 by
1.7.2