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 mbed-rtos N5110 ShiftReg Tone
Revision 1:7dfa61225fcf, committed 2021-03-19
- Comitter:
- el18a2k
- Date:
- Fri Mar 19 17:28:12 2021 +0000
- Parent:
- 0:cf9660998431
- Child:
- 2:532b0225519f
- Commit message:
- Fish Engine Built,
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/classes/FishEngine.cpp Fri Mar 19 17:28:12 2021 +0000
@@ -0,0 +1,36 @@
+#include "FishEngine.h"
+
+BusOut RGB_led(p24,p23,p22); //RGB bus MSB - LSB, inverted logic 1 = low
+
+ShiftReg shift;
+Graphics graphics;
+
+DigitalIn button_A (p29);
+
+void FishEngine::system_init(N5110 &lcd, Tone &dac){
+ lcd.init();
+ lcd.setBrightness(0.5);
+ dac.init();
+ shift.write(0x00);
+ RGB_led.write(0b111);
+}
+
+void FishEngine::titleSequence(N5110 &lcd){
+ button_A.mode(PullNone);
+ lcd.clear();
+ graphics.titleScreen(lcd);
+ lcd.refresh();
+ wait_ms(1000);
+
+ while(button_A.read() == 0){
+ lcd.clear();
+ graphics.confirmationScreen(lcd);
+ lcd.refresh();
+ wait_ms(1000/10);
+ }
+
+ graphics.screenFlash(lcd);
+ lcd.refresh();
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/classes/FishEngine.h Fri Mar 19 17:28:12 2021 +0000
@@ -0,0 +1,17 @@
+#ifndef FISHENGINE_H
+#define FISHENGINE_H
+
+#include "N5110.h"
+#include "Tone.h"
+#include "ShiftReg.h"
+
+#include "Graphics.h"
+
+class FishEngine {
+
+public:
+ void system_init(N5110 &lcd, Tone &dac);
+ void titleSequence(N5110 &lcd);
+};
+
+#endif
\ No newline at end of file
--- a/classes/Graphics.cpp Fri Mar 19 16:27:52 2021 +0000
+++ b/classes/Graphics.cpp Fri Mar 19 17:28:12 2021 +0000
@@ -288,6 +288,7 @@
wait_ms(1000);
lcd.drawSprite(59,2,44,21,(int*)Title_fish_eaten);
lcd.refresh();
+ wait_ms(1000);
}
void Graphics::screenFlash(N5110 &lcd){
--- a/main.cpp Fri Mar 19 16:27:52 2021 +0000
+++ b/main.cpp Fri Mar 19 17:28:12 2021 +0000
@@ -1,32 +1,20 @@
#include "mbed.h"
-#include "N5110.h"
-#include "Graphics.h"
+#include "FishEngine.h"
N5110 lcd(p8,p9,p10,p11,p13,p21);
-Graphics graphics;
+Tone dac(p18);
+
+FishEngine fish;
-DigitalIn button_A (p29);
+BusOut leds(LED4,LED3,LED2,LED1);
+
+void system_init();
int main(){
- lcd.init();
- button_A.mode(PullNone);
+ fish.system_init(lcd,dac);
while(1){
- lcd.clear();
- graphics.titleScreen(lcd);
- lcd.refresh();
- wait_ms(1000/10);
-
- while(button_A.read() == 0){
- lcd.clear();
- graphics.confirmationScreen(lcd);
- lcd.refresh();
- wait_ms(1000/10);
- }
-
- graphics.screenFlash(lcd);
- lcd.refresh();
+ fish.titleSequence(lcd);
+ wait_ms(1000);
}
-
-
}
\ No newline at end of file