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
Fork of display_nums2 by
Diff: display.cpp
- Revision:
- 2:8a0f128f4be5
- Parent:
- 1:3d6796759d45
- Child:
- 3:1acb956e61b2
diff -r 3d6796759d45 -r 8a0f128f4be5 display.cpp
--- a/display.cpp Fri Mar 09 15:53:04 2018 +0000
+++ b/display.cpp Fri Mar 09 18:37:09 2018 +0000
@@ -5,21 +5,10 @@
#include <spi.h>
-spi_cfg as1107 = {
-
- SPI_AS1107_ID,
- DSP_AS1107_NCS,
- AS1107_MODE, //mode
- AS1107_FREQ, //frequency
- AS1107_BITS //num of bits
-};
-//YOU JUST MOVED THE THING SO THIS PROBABLY WON'T WORK RN IF YOU COMPILE
Serial pc_display(USBTX, USBRX);
-
-
-
+extern spi_cfg AS1107 = { SPI_AS1107_ID, DSP_AS1107_NCS, AS1107_MODE, AS1107_FREQ, AS1107_BITS,};
void bin2bcd_array_mod(int *bcdArr, int num){
for(int i = 0; i < 4; i++){
@@ -30,23 +19,23 @@
bcdArr[3-i] = num%10;
num = num/10;
i = i+1;
-}
+ }
}
void display_init(){
// Configuring the Controller
- spi_send(as1107, 0x0f01);
+ spi_send(AS1107, 0x0f01);
wait(1.5);
- spi_send(as1107, 0x0F00);
- spi_send(as1107, 0x0A0F);
- spi_send(as1107, 0x0B04);
- spi_send(as1107, 0x0C01); //set to normal shutdown mode
- spi_send(as1107, 0x090F); //configures the decode register
- spi_send(as1107, DISPLAY_1); //Digit 1 is 0
- spi_send(as1107, DISPLAY_2);
- spi_send(as1107, DISPLAY_3);
- spi_send(as1107, DISPLAY_4);
- spi_send(as1107, LED_DISPLAY);
+ spi_send(AS1107, 0x0F00);
+ spi_send(AS1107, 0x0A0F);
+ spi_send(AS1107, 0x0B04);
+ spi_send(AS1107, 0x0C01); //set to normal shutdown mode
+ spi_send(AS1107, 0x090F); //configures the decode register
+ spi_send(AS1107, DISPLAY_1); //Digit 1 is 0
+ spi_send(AS1107, DISPLAY_2);
+ spi_send(AS1107, DISPLAY_3);
+ spi_send(AS1107, DISPLAY_4);
+ spi_send(AS1107, LED_DISPLAY);
}
void bin2bcd_array_sprintf(int *bcdArr, int num){
