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: Memory25L16_fast USBDevice mbed
Fork of BlackBoard_Firmware_MVP by
Diff: BB_Basic.cpp
- Revision:
- 8:3577b060d7af
- Parent:
- 7:b30c411a6d36
- Child:
- 9:7c0f42f090e8
diff -r b30c411a6d36 -r 3577b060d7af BB_Basic.cpp
--- a/BB_Basic.cpp Tue Jan 31 05:10:44 2017 +0000
+++ b/BB_Basic.cpp Tue Feb 14 00:31:24 2017 +0000
@@ -276,7 +276,7 @@
* keyCheck(), scanss the keys and sends the keypress to the pc over usb
*/
void keyCheck(){
- pc.printf("KeyCheck\n");
+ //pc.printf("KeyCheck\n");
if (keyScan()>0) { //check if keyScan returned key presss
pc.printf("\nKey scan|n");
int countpos =0;
@@ -411,6 +411,7 @@
{
int temp [] = {0x31,slot,nameList[slot][0],nameList[slot][1],nameList[slot][2],nameList[slot][3],nameList[slot][4],0};
sendUSB(temp);
+ pc.printf("\nSlot %d = %c%c%c%c%c",slot, nameList[slot][0],nameList[slot][1],nameList[slot][2],nameList[slot][3],nameList[slot][4]);
}
@@ -421,7 +422,7 @@
{
for(int slot =0; slot< 16; slot++) {
getLayoutName(slot);
- }
+ }
}
/**
@@ -439,7 +440,7 @@
void nameBlock(SPI my_spi, char name[], int slot)
{
//char temp[]= {name};
- mem.writeData(my_spi, name, slots[slot]+0x1fff9, 5);
+ mem.writeData(my_spi, name, slots[slot]+0x1ff00, 5);
}
/**
@@ -449,7 +450,7 @@
{
for(int slot=0; slot<16; slot++) {
char name[5];
- mem.readData(my_spi, name, slots[slot]+0x1FFF9, 5); //Read five bytes from the end of a slot into the name array
+ mem.readData(my_spi, name, slots[slot]+0x1FF00, 5); //Read five bytes from the end of a slot into the name array
for( int i = 0; i<5; i++) {
nameList[slot][i]=name[i];
}
@@ -464,8 +465,10 @@
pc.printf("\nSlot: %i", slots[slot]);
mem.blockErase(my_spi, slots[slot]); //erase the bottom block of the slot
mem.blockErase(my_spi, slots[slot]+0x10000); //erase the top block of the slot
+ pc.printf("\nWorking");
nameBlock(my_spi, name, slots[slot]/*+0x1FFF9*/); //Write the name of the layout to memory
erasedSlots[slot]=true; //Mark the erased slot as true
+ populateNameList(my_spi);
}
@@ -573,7 +576,7 @@
populateNameList(my_spi); //Reads the names of layouts stored in external memory into RAM
while(1) {
- pc.printf("Loop");
+ //pc.printf("Loop");
sendUSB(readyForComand);
keyCheck();
@@ -599,8 +602,12 @@
//pc.printf(" \n---EPD UPDATE--- %i",USBDataBuffer[2]*65536+USBDataBuffer[3]*256+USBDataBuffer[4]);
EPD_Write(my_spi, USBDataBuffer[2]*65536+USBDataBuffer[3]*256+USBDataBuffer[4]);
break;
+ case 0x21: //If the recieved comand is a swap instruction
+ EPD_Swap(my_spi, USBDataBuffer[2]);
+ break;
case 0x30: //If the recieved comand is a request for the cutrrent name
- getCurrentLayout();
+ populateNameList(my_spi);
+ getNameList();
break;
case 0x35: //If the recieved comand is a request for all the names
getCurrentLayout();
