|
@@ -6,7 +6,10 @@
|
|
|
|
|
|
/* Private constants */
|
|
|
#define MAX_COLUMN (DISPLAY_COLUMNS - 1)
|
|
|
-#define FONT_WIDTH 8
|
|
|
+#define FONT_WIDTH 6
|
|
|
+#define STR_BUF_SYM 40
|
|
|
+#define STR_BUF_PAD (DISPLAY_COLUMNS / FONT_WIDTH)
|
|
|
+#define STR_BUF_SIZE ((STR_BUF_PAD + STR_BUF_SYM + STR_BUF_PAD) * FONT_WIDTH)
|
|
|
|
|
|
/* private macros */
|
|
|
/* Private variables */
|
|
@@ -40,7 +43,7 @@ void display_Init(void) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @brief Out ot display one symbol in specified column
|
|
|
+ * @brief Out to display one symbol from specified column
|
|
|
*
|
|
|
* @param symb Symbol to display
|
|
|
* @param column column from 0 to DISPLAY_COLUMNS-1
|
|
@@ -59,6 +62,39 @@ void display_Char(const uint8_t symb, const uint8_t column) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * @brief Out string to display. Running string. Left shit.
|
|
|
+ * @param string String to display, null terminated.
|
|
|
+ * @param repeat Times to repeat.
|
|
|
+ */
|
|
|
+void display_String(const char * string, uint8_t repeat) {
|
|
|
+ if (repeat == 0) { return; }
|
|
|
+ if (string[0] == 0) { return; }
|
|
|
+
|
|
|
+ uint8_t str_buf[STR_BUF_SIZE] = {0};
|
|
|
+ int i = 0, j = DISPLAY_COLUMNS;
|
|
|
+ while ((string[i] != '\0') && (i < STR_BUF_SYM)) {
|
|
|
+ str_buf[j] = string[i];
|
|
|
+ i ++;
|
|
|
+ j ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ int k = 0;
|
|
|
+ while (repeat) {
|
|
|
+ for (k=0; k<j; k++) {
|
|
|
+ for (i=0; i<DISPLAY_COLUMNS; i++) {
|
|
|
+ display_Buffer[i] = str_buf[k+i];
|
|
|
+ }
|
|
|
+ display_WriteBuffer();
|
|
|
+ tdelay_ms(200);
|
|
|
+ }
|
|
|
+ tdelay_ms(500);
|
|
|
+
|
|
|
+ /* End of man loop */
|
|
|
+ repeat --;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* @brief Set HT1632C PWM Value
|
|
|
* @param pwm value in 0-15
|
|
@@ -203,7 +239,7 @@ void display_WriteData(const uint8_t * data, uint8_t addr, uint8_t len) {
|
|
|
while ((SPI1->SR & SPI_SR_BSY) != 0) { __NOP(); }
|
|
|
HT1632C_CS_OFF;
|
|
|
|
|
|
- // with dam
|
|
|
+ // with dma
|
|
|
uint16_t a = 0x280 | addr;
|
|
|
|
|
|
/* Wait for SPI */
|
|
@@ -303,7 +339,7 @@ void display_WriteBuffer(void) {
|
|
|
void display_Fill(uint8_t pattern) {
|
|
|
int i;
|
|
|
for (i=0; i<DISPLAY_COLUMNS; i++) {
|
|
|
- display_Buffer[i] = 0x0;
|
|
|
+ display_Buffer[i] = pattern;
|
|
|
}
|
|
|
display_WriteBuffer();
|
|
|
}
|