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: mbed qnode2 MFRC522-2 eeprom Buffer2
Revision 11:da25ed58aab0, committed 2019-05-24
- Comitter:
- alejo5214416
- Date:
- Fri May 24 03:43:43 2019 +0000
- Parent:
- 10:90a9aa4482e8
- Commit message:
- ,.
Changed in this revision
--- a/Buffer.lib Tue Jul 31 22:54:29 2018 +0000 +++ b/Buffer.lib Fri May 24 03:43:43 2019 +0000 @@ -1,1 +1,1 @@ -Buffer#9375e70ace0a +https://os.mbed.com/users/alejo5214416/code/Buffer2/#9375e70ace0a
--- a/MFRC522.lib Tue Jul 31 22:54:29 2018 +0000 +++ b/MFRC522.lib Fri May 24 03:43:43 2019 +0000 @@ -1,1 +1,1 @@ -MFRC522#4d0b06f52496 +https://os.mbed.com/users/alejo5214416/code/MFRC522-2/#4d0b06f52496
--- a/eeprom.lib Tue Jul 31 22:54:29 2018 +0000 +++ b/eeprom.lib Fri May 24 03:43:43 2019 +0000 @@ -1,1 +1,1 @@ -eeprom#09a5710f6b7c +https://os.mbed.com/users/alejo5214416/code/eeprom/#09a5710f6b7c
--- a/main.cpp Tue Jul 31 22:54:29 2018 +0000 +++ b/main.cpp Fri May 24 03:43:43 2019 +0000 @@ -4,6 +4,7 @@ #include "Buffer.h" #include "eeprom.h" #define eepr_addr 0x50 +#define max_size 300 uint16_t const count_address=0x0000; I2C i2c(p28,p27); @@ -25,13 +26,19 @@ volatile bool buf2ready=false; -void insertionSort(uint16_t array[], uint8_t count); +typedef union reg{ + uint8_t uid_reg[4]; + uint32_t clave; + }reg; + + reg dtb[max_size]; + +void insertionSort(reg *regs, uint8_t count); void interrupcion(); void disp_unoTx_isr(); void disp_unoRx_isr(); void flush_memory(); - int main() { uint16_t adr=0x0001; @@ -48,31 +55,40 @@ //count = 0x0001; //-------->>>>>>para iniciar el conteo en 0 de la memoria de cantidad de uid registrados //write_data(eepr_addr, count_address,&count);//---->>> uint8_t count = data_read(eepr_addr, count_address); - uint8_t uid=0x00; + uint16_t uid=0x00; if (count>0) { - uint16_t array[count]; + //uint16_t array[count]; pc.printf("\n%x UID's registrados en memoria\n",count); for(uid=0x00; uid<count; uid++) { - array[uid]=0; - for(uint16_t byte_uid=0x0000; byte_uid<4; byte_uid++) { + //array[uid]=0; + for(uint8_t byte_uid=0; byte_uid<4; byte_uid++) { //printf("Suma %x",array[uid]); - printf("%02X",data_read(eepr_addr, (uint16_t(uid*4)+uint16_t(byte_uid)+0x0001))); - array[uid] = array[uid]+ data_read(eepr_addr, (uint16_t(uid*4)+uint16_t(byte_uid)+0x0001)); + printf("%02X",data_read(eepr_addr, (uid*4)+byte_uid+0x01)); + //array[uid] = array[uid]+ data_read(eepr_addr, (uint16_t(uid*4)+uint16_t(byte_uid)+0x0001)); + dtb[uid].uid_reg[byte_uid] = data_read(eepr_addr,(uid*4)+byte_uid+0x01); } + //insertionSort(&dtb[0], count); printf("\n"); //printf("Posicion del arreglo:%d valor:%03X",uid+1,array[uid]); } - pc.printf("\nValores desordenados "); + + pc.printf("\nValores Ordenados "); + insertionSort(&dtb[0], count); for(uint8_t d=0x00; d<count; d++) { - pc.printf("%03X ",array[d]); + for(int i=0;i<4;i++){ + pc.printf("%02X",dtb[d].uid_reg[i]); + } + pc.printf("\n"); } + /* pc.printf("\nValores Ordenados "); - insertionSort(array, count); + insertionSort(dtb, count); for(uint8_t d=0x00; d<count; d++) { - pc.printf("%03X ",array[d]); + pc.printf("%03X ",dtb[d]); } + */ } else{ pc.printf("%x UID's registrados en memoria\n",count); @@ -167,20 +183,21 @@ -void insertionSort(uint16_t array[], uint8_t count) +void insertionSort(reg *regs, uint8_t count) { - int i, key, j; + uint32_t i, key; + int j; for (i = 1; i < count; i++) { - key = array[i]; + key = regs[i].clave; j = i-1; /* Move elements of arr[0..i-1], that are greater than key, to one position ahead of their current position */ - while (j >= 0 && array[j] > key) { - array[j+1] = array[j]; + while ((j>=0) && (regs[j].clave> key)) { + regs[j+1].clave = regs[j].clave; j = j-1; } - array[j+1] = key; + regs[j+1].clave = key; } } \ No newline at end of file
--- a/qnode.lib Tue Jul 31 22:54:29 2018 +0000 +++ b/qnode.lib Fri May 24 03:43:43 2019 +0000 @@ -1,1 +1,1 @@ -qnode#28ba51765608 +https://os.mbed.com/users/alejo5214416/code/qnode2/#28ba51765608