Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • card10/firmware
  • annejan/firmware
  • astro/firmware
  • fpletz/firmware
  • gerd/firmware
  • fleur/firmware
  • swym/firmware
  • l/firmware
  • uberardy/firmware
  • wink/firmware
  • madonius/firmware
  • mot/firmware
  • filid/firmware
  • q3k/firmware
  • hauke/firmware
  • Woazboat/firmware
  • pink/firmware
  • mossmann/firmware
  • omniskop/firmware
  • zenox/firmware
  • trilader/firmware
  • Danukeru/firmware
  • shoragan/firmware
  • zlatko/firmware
  • sistason/firmware
  • datenwolf/firmware
  • bene/firmware
  • amedee/firmware
  • martinling/firmware
  • griffon/firmware
  • chris007/firmware
  • adisbladis/firmware
  • dbrgn/firmware
  • jelly/firmware
  • rnestler/firmware
  • mh/firmware
  • ln/firmware
  • penguineer/firmware
  • monkeydom/firmware
  • jens/firmware
  • jnaulty/firmware
  • jeffmakes/firmware
  • marekventur/firmware
  • pete/firmware
  • h2obrain/firmware
  • DooMMasteR/firmware
  • jackie/firmware
  • prof_r/firmware
  • Draradech/firmware
  • Kartoffel/firmware
  • hinerk/firmware
  • abbradar/firmware
  • JustTB/firmware
  • LuKaRo/firmware
  • iggy/firmware
  • ente/firmware
  • flgr/firmware
  • Lorphos/firmware
  • matejo/firmware
  • ceddral7/firmware
  • danb/firmware
  • joshi/firmware
  • melle/firmware
  • fitch/firmware
  • deurknop/firmware
  • sargon/firmware
  • markus/firmware
  • kloenk/firmware
  • lucaswerkmeister/firmware
  • derf/firmware
  • meh/firmware
  • dx/card10-firmware
  • torben/firmware
  • yuvadm/firmware
  • AndyBS/firmware
  • klausdieter1/firmware
  • katzenparadoxon/firmware
  • xiretza/firmware
  • ole/firmware
  • techy/firmware
  • thor77/firmware
  • TilCreator/firmware
  • fuchsi/firmware
  • dos/firmware
  • yrlf/firmware
  • PetePriority/firmware
  • SuperVirus/firmware
  • sur5r/firmware
  • tazz/firmware
  • Alienmaster/firmware
  • flo_h/firmware
  • baldo/firmware
  • mmu_man/firmware
  • Foaly/firmware
  • sodoku/firmware
  • Guinness/firmware
  • ssp/firmware
  • led02/firmware
  • Stormwind/firmware
  • arist/firmware
  • coon/firmware
  • mdik/firmware
  • pippin/firmware
  • royrobotiks/firmware
  • zigot83/firmware
  • mo_k/firmware
106 results
Select Git revision
Loading items
Show changes
Showing
with 929 additions and 882 deletions
...@@ -64,7 +64,6 @@ int main(void) ...@@ -64,7 +64,6 @@ int main(void)
uint32_t poll_period = 5, test_dur_ms = 30000; uint32_t poll_period = 5, test_dur_ms = 30000;
uint16_t int_status; uint16_t int_status;
bma.intf_ptr = NULL; /* To attach your interface device reference */ bma.intf_ptr = NULL; /* To attach your interface device reference */
bma.delay_ms = card10_bosch_delay; bma.delay_ms = card10_bosch_delay;
bma.dev_id = BMA400_I2C_ADDRESS_SDO_LOW; bma.dev_id = BMA400_I2C_ADDRESS_SDO_LOW;
...@@ -77,7 +76,6 @@ int main(void) ...@@ -77,7 +76,6 @@ int main(void)
printf("BMA400 found with chip ID 0x%X\r\n", bma.chip_id); printf("BMA400 found with chip ID 0x%X\r\n", bma.chip_id);
} }
print_rslt(rslt); print_rslt(rslt);
rslt = bma400_soft_reset(&bma); rslt = bma400_soft_reset(&bma);
...@@ -138,6 +136,5 @@ int main(void) ...@@ -138,6 +136,5 @@ int main(void)
test_dur_ms -= poll_period; test_dur_ms -= poll_period;
} }
} }
} }
file ../../build/hw-tests/bmetest/bmetest.elf
source ../../.gdbinit
source ../../init.gdb
file ../../build/hw-tests/bmetest/bmetest.elf
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
#include "gpio.h" #include "gpio.h"
#include "bme680.h" #include "bme680.h"
#include "bosch.h" #include "bosch.h"
#include "GUI_DEV/GUI_Paint.h" #include "gfx.h"
#include "framebuffer.h"
#include "display.h"
#include "Fonts/fonts.h" #include "Fonts/fonts.h"
#include "card10.h" #include "card10.h"
...@@ -63,8 +65,9 @@ int main(void) ...@@ -63,8 +65,9 @@ int main(void)
gas_sensor.power_mode = BME680_FORCED_MODE; gas_sensor.power_mode = BME680_FORCED_MODE;
/* Set the required sensor settings needed */ /* Set the required sensor settings needed */
set_required_settings = BME680_OST_SEL | BME680_OSP_SEL | BME680_OSH_SEL | BME680_FILTER_SEL set_required_settings = BME680_OST_SEL | BME680_OSP_SEL |
| BME680_GAS_SENSOR_SEL; BME680_OSH_SEL | BME680_FILTER_SEL |
BME680_GAS_SENSOR_SEL;
/* Set the desired sensor configuration */ /* Set the desired sensor configuration */
rslt = bme680_set_sensor_settings(set_required_settings, &gas_sensor); rslt = bme680_set_sensor_settings(set_required_settings, &gas_sensor);
...@@ -72,25 +75,28 @@ int main(void) ...@@ -72,25 +75,28 @@ int main(void)
/* Set the power mode */ /* Set the power mode */
rslt = bme680_set_sensor_mode(&gas_sensor); rslt = bme680_set_sensor_mode(&gas_sensor);
Color white = gfx_color(&display_screen, WHITE);
Color black = gfx_color(&display_screen, BLACK);
while (1) { while (1) {
TMR_Delay(MXC_TMR0, MSEC(1000), 0); TMR_Delay(MXC_TMR0, MSEC(1000), 0);
struct bme680_field_data data; struct bme680_field_data data;
rslt = bme680_get_sensor_data(&data, &gas_sensor); rslt = bme680_get_sensor_data(&data, &gas_sensor);
printf("T: %.2Lf degC, P: %.2Lf hPa, H %.2Lf %%rH ", data.temperature / 100.0l, printf("T: %.2Lf degC, P: %.2Lf hPa, H %.2Lf %%rH ",
data.pressure / 100.0l, data.humidity / 1000.0l ); data.temperature / 100.0l,
data.pressure / 100.0l,
data.humidity / 1000.0l);
char buf[128]; char buf[128];
sprintf(buf, "T: %.2Lf degC", data.temperature / 100.0l); sprintf(buf, "T: %.2Lf degC", data.temperature / 100.0l);
Paint_DrawString_EN(0, 0, buf, &Font16, 0x0000, 0xffff); gfx_puts(&Font16, &display_screen, 0, 0, buf, white, black);
sprintf(buf, "P: %.2Lf hPa", data.pressure / 100.0l); sprintf(buf, "P: %.2Lf hPa", data.pressure / 100.0l);
Paint_DrawString_EN(0, 16, buf, &Font16, 0x0000, 0xffff); gfx_puts(&Font16, &display_screen, 0, 16, buf, white, black);
sprintf(buf, "H: %.2Lf %%rH", data.humidity / 1000.0l); sprintf(buf, "H: %.2Lf %%rH", data.humidity / 1000.0l);
Paint_DrawString_EN(0, 32, buf, &Font16, 0x0000, 0xffff); gfx_puts(&Font16, &display_screen, 0, 32, buf, white, black);
//printf("%.2f,%.2f,%.2f\n", data.temperature / 100.0f, //printf("%.2f,%.2f,%.2f\n", data.temperature / 100.0f,
// data.pressure / 100.0f, data.humidity / 1000.0f ); // data.pressure / 100.0f, data.humidity / 1000.0f );
...@@ -98,10 +104,18 @@ int main(void) ...@@ -98,10 +104,18 @@ int main(void)
if (data.status & BME680_GASM_VALID_MSK) { if (data.status & BME680_GASM_VALID_MSK) {
printf(", G: %ld ohms", data.gas_resistance); printf(", G: %ld ohms", data.gas_resistance);
sprintf(buf, "G: %ld ohms", data.gas_resistance); sprintf(buf, "G: %ld ohms", data.gas_resistance);
Paint_DrawString_EN(0, 48, buf, &Font16, 0x0000, 0xffff); gfx_puts(
&Font16,
&display_screen,
0,
48,
buf,
white,
black
);
} }
LCD_Update(); gfx_update(&display_screen);
printf("\n"); printf("\n");
......
...@@ -6,10 +6,9 @@ ...@@ -6,10 +6,9 @@
#include "card10.h" #include "card10.h"
#include "bootloader-9251ea6.h" #include "bootloader-9251ea6.h"
#include "display.h" #include "display.h"
#include "GUI_Paint.h" #include "gfx.h"
#include "pmic.h" #include "pmic.h"
#include "flc.h" #include "flc.h"
#include "icc.h" #include "icc.h"
#include "tmr_utils.h" #include "tmr_utils.h"
...@@ -37,45 +36,43 @@ static void pmic_button(bool falling) ...@@ -37,45 +36,43 @@ static void pmic_button(bool falling)
} }
} }
int main(void) int main(void)
{ {
card10_init(); card10_init();
pmic_set_button_callback(pmic_button); pmic_set_button_callback(pmic_button);
printf("Erasing bootloader.\n"); printf("Erasing bootloader.\n");
Paint_DrawString_EN(0, 16*0, "Erasing bootloader", &Font16, 0x0000, 0xffff); txt_puts(&display_textb, "Erasing bootloader.\n");
LCD_Update();
ICC_Disable(); ICC_Disable();
int ret = FLC_MultiPageErase(0x10000000, 0x10000000 + 1024 * 64 - 1); int ret = FLC_MultiPageErase(0x10000000, 0x10000000 + 1024 * 64 - 1);
if (ret != E_NO_ERROR) { if (ret != E_NO_ERROR) {
printf("FLC_MultiPageErase failed with %d\n", ret); printf("FLC_MultiPageErase failed with %d\n", ret);
Paint_DrawString_EN(0, 16*1, "Fail.", &Font16, 0x0000, 0xffff); txt_puts(&display_textb, "Fail.\n");
LCD_Update(); while (1)
while(1); ;
} }
printf("Writing bootloader.\n"); printf("Writing bootloader.\n");
Paint_DrawString_EN(0, 16*0, "Writing bootloader ", &Font16, 0x0000, 0xffff); txt_puts(&display_textb, "Writing bootloader.\n");
LCD_Update();
ret = FLC_Write(0x10000000, sizeof(bootloader_data), (uint32_t *)bootloader_data); ret = FLC_Write(
0x10000000,
sizeof(bootloader_data),
(uint32_t *)bootloader_data
);
if (ret != E_NO_ERROR) { if (ret != E_NO_ERROR) {
printf("FLC_Write failed with %d\n", ret); printf("FLC_Write failed with %d\n", ret);
Paint_DrawString_EN(0, 16*1, "Fail.", &Font16, 0x0000, 0xffff); txt_puts(&display_textb, "Fail.\n");
LCD_Update(); while (1)
while(1); ;
} }
ICC_Enable(); ICC_Enable();
printf("Done.\n"); printf("Done.\n");
Paint_DrawString_EN(0, 16*1, "Done.", &Font16, 0x0000, 0xffff); txt_puts(&display_textb, "Done.\n");
Paint_DrawString_EN(0, 16*2, "Please restart", &Font16, 0x0000, 0xffff); txt_puts(&display_textb, "Please restart.\n");
LCD_Update();
while (1) { while (1) {
card10_poll(); card10_poll();
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
#include "gpio.h" #include "gpio.h"
#include "mxc_delay.h" #include "mxc_delay.h"
static const __attribute__((unused)) gpio_cfg_t motor_pin = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE}; static const __attribute__((unused))
gpio_cfg_t motor_pin = { PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE };
int main(void) int main(void)
{ {
......
source ../../.gdbinit source ../../init.gdb
set confirm off set confirm off
......
...@@ -3,45 +3,42 @@ ...@@ -3,45 +3,42 @@
******************************************************************************/ ******************************************************************************/
/***** Includes *****/ /***** Includes *****/
#include "pmic.h"
#include "leds.h"
#include "card10.h" #include "card10.h"
#include "leds.h"
#include "pmic.h"
#include "GUI_Paint.h" #include "display.h"
#include "gfx.h"
#include "tmr_utils.h" #include "tmr_utils.h"
#include <stdio.h> #include <Heart.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <Heart.h>
int main(void) int main(void)
{ {
card10_init(); card10_init();
card10_diag(); card10_diag();
Paint_DrawImage(Heart, 0, 0, 160, 80); gfx_copy_region(
LCD_Update(); &display_screen,
0,
for(int i=0; i<11; i++) { 0,
leds_set_dim(i, 1); 160,
} 80,
GFX_RGB565,
int h = 0; (const void *)(Heart)
);
gfx_update(&display_screen);
// Release core1 // Release core1
core1_start(); core1_start((void *)0x10080000);
int h = 0;
while (1) { while (1) {
#define NUM 15 #define NUM 15
for(int i=0; i<NUM; i++) {
if(i < 12) {
leds_set_hsv(i, (h + 360/NUM * i) % 360, 1., 1./8);
} else {
leds_set_hsv(i, (h + 360/NUM * i) % 360, 1., 1.);
}
}
leds_update(); leds_update();
TMR_Delay(MXC_TMR0, MSEC(10), 0); TMR_Delay(MXC_TMR0, MSEC(10), 0);
......
...@@ -3,7 +3,7 @@ executable( ...@@ -3,7 +3,7 @@ executable(
name + '.elf', name + '.elf',
'main.c', 'main.c',
dependencies: [libcard10, max32665_startup_core0], dependencies: [libcard10, max32665_startup_core0],
link_whole: [max32665_startup_core0_lib, board_card10_lib], link_whole: [max32665_startup_core0_lib, board_card10_lib, newlib_heap_lib],
link_args: [ link_args: [
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
], ],
...@@ -14,7 +14,7 @@ executable( ...@@ -14,7 +14,7 @@ executable(
name + '.elf', name + '.elf',
'core1.c', 'core1.c',
dependencies: [periphdriver, board_card10, max32665_startup_core1], dependencies: [periphdriver, board_card10, max32665_startup_core1],
link_whole: [max32665_startup_core1_lib, board_card10_lib], link_whole: [max32665_startup_core1_lib, board_card10_lib, newlib_heap_lib],
link_args: [ link_args: [
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
], ],
......
file ../../build/hw-tests/ecgtest/ecgtest.elf
source ../../.gdbinit
source ../../init.gdb
file ../../build/hw-tests/ecgtest/ecgtest.elf
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
#include "spi.h" #include "spi.h"
#include "pb.h" #include "pb.h"
#include "MAX30003.h" #include "MAX30003.h"
#include "GUI_DEV/GUI_Paint.h" #include "gfx.h"
#include "LCD_Driver.h"
#include "display.h"
#include "pmic.h" #include "pmic.h"
#include "card10.h" #include "card10.h"
#include <stdbool.h> #include <stdbool.h>
...@@ -56,7 +58,9 @@ static void ecg_write_reg(uint8_t reg, uint32_t data) ...@@ -56,7 +58,9 @@ static void ecg_write_reg(uint8_t reg, uint32_t data)
{ {
printf("write %02x %06lx\n", reg, data); printf("write %02x %06lx\n", reg, data);
spi_req_t req; spi_req_t req;
uint8_t tx_data[] = {(reg << 1) | 0 , data >> 16, (data >> 8 ) & 0xFF, data & 0xFF}; uint8_t tx_data[] = {
(reg << 1) | 0, data >> 16, (data >> 8) & 0xFF, data & 0xFF
};
uint8_t rx_data[] = { 0, 0, 0, 0 }; uint8_t rx_data[] = { 0, 0, 0, 0 };
req.tx_data = tx_data; req.tx_data = tx_data;
req.rx_data = rx_data; req.rx_data = rx_data;
...@@ -81,12 +85,16 @@ static void ecg_config(bool enable_internal_pull) ...@@ -81,12 +85,16 @@ static void ecg_config(bool enable_internal_pull)
union GeneralConfiguration_u CNFG_GEN_r; union GeneralConfiguration_u CNFG_GEN_r;
CNFG_GEN_r.bits.en_ecg = 1; // Enable ECG channel CNFG_GEN_r.bits.en_ecg = 1; // Enable ECG channel
if (enable_internal_pull) { if (enable_internal_pull) {
CNFG_GEN_r.bits.rbiasn = 1; // Enable resistive bias on negative input CNFG_GEN_r.bits.rbiasn =
CNFG_GEN_r.bits.rbiasp = 1; // Enable resistive bias on positive input 1; // Enable resistive bias on negative input
CNFG_GEN_r.bits.rbiasp =
1; // Enable resistive bias on positive input
CNFG_GEN_r.bits.en_rbias = 1; // Enable resistive bias CNFG_GEN_r.bits.en_rbias = 1; // Enable resistive bias
} else { } else {
CNFG_GEN_r.bits.rbiasn = 0; // Enable resistive bias on negative input CNFG_GEN_r.bits.rbiasn =
CNFG_GEN_r.bits.rbiasp = 0; // Enable resistive bias on positive input 0; // Enable resistive bias on negative input
CNFG_GEN_r.bits.rbiasp =
0; // Enable resistive bias on positive input
CNFG_GEN_r.bits.en_rbias = 0; // Enable resistive bias CNFG_GEN_r.bits.en_rbias = 0; // Enable resistive bias
} }
...@@ -94,7 +102,6 @@ static void ecg_config(bool enable_internal_pull) ...@@ -94,7 +102,6 @@ static void ecg_config(bool enable_internal_pull)
CNFG_GEN_r.bits.en_dcloff = 1; // Enable DC lead-off detection CNFG_GEN_r.bits.en_dcloff = 1; // Enable DC lead-off detection
ecg_write_reg(CNFG_GEN, CNFG_GEN_r.all); ecg_write_reg(CNFG_GEN, CNFG_GEN_r.all);
// ECG Config register setting // ECG Config register setting
union ECGConfiguration_u CNFG_ECG_r; union ECGConfiguration_u CNFG_ECG_r;
CNFG_ECG_r.bits.dlpf = 1; // Digital LPF cutoff = 40Hz CNFG_ECG_r.bits.dlpf = 1; // Digital LPF cutoff = 40Hz
...@@ -105,20 +112,17 @@ static void ecg_config(bool enable_internal_pull) ...@@ -105,20 +112,17 @@ static void ecg_config(bool enable_internal_pull)
//CNFG_ECG_r.bits.rate = 1; // Sample rate = 256 sps //CNFG_ECG_r.bits.rate = 1; // Sample rate = 256 sps
ecg_write_reg(CNFG_ECG, CNFG_ECG_r.all); ecg_write_reg(CNFG_ECG, CNFG_ECG_r.all);
//R-to-R configuration //R-to-R configuration
union RtoR1Configuration_u CNFG_RTOR_r; union RtoR1Configuration_u CNFG_RTOR_r;
CNFG_RTOR_r.bits.en_rtor = 1; // Enable R-to-R detection CNFG_RTOR_r.bits.en_rtor = 1; // Enable R-to-R detection
ecg_write_reg(CNFG_RTOR1, CNFG_RTOR_r.all); ecg_write_reg(CNFG_RTOR1, CNFG_RTOR_r.all);
//Manage interrupts register setting //Manage interrupts register setting
union ManageInterrupts_u MNG_INT_r; union ManageInterrupts_u MNG_INT_r;
MNG_INT_r.bits.efit = 0b00011; // Assert EINT w/ 4 unread samples MNG_INT_r.bits.efit = 0b00011; // Assert EINT w/ 4 unread samples
MNG_INT_r.bits.clr_rrint = 0b01; // Clear R-to-R on RTOR reg. read back MNG_INT_r.bits.clr_rrint = 0b01; // Clear R-to-R on RTOR reg. read back
ecg_write_reg(MNGR_INT, MNG_INT_r.all); ecg_write_reg(MNGR_INT, MNG_INT_r.all);
//Enable interrupts register setting //Enable interrupts register setting
union EnableInterrupts_u EN_INT_r; union EnableInterrupts_u EN_INT_r;
EN_INT_r.all = 0; EN_INT_r.all = 0;
...@@ -127,7 +131,6 @@ static void ecg_config(bool enable_internal_pull) ...@@ -127,7 +131,6 @@ static void ecg_config(bool enable_internal_pull)
EN_INT_r.bits.intb_type = 3; // Open-drain NMOS with internal pullup EN_INT_r.bits.intb_type = 3; // Open-drain NMOS with internal pullup
ecg_write_reg(EN_INT, EN_INT_r.all); ecg_write_reg(EN_INT, EN_INT_r.all);
//Dyanmic modes config //Dyanmic modes config
union ManageDynamicModes_u MNG_DYN_r; union ManageDynamicModes_u MNG_DYN_r;
MNG_DYN_r.bits.fast = 0; // Fast recovery mode disabled MNG_DYN_r.bits.fast = 0; // Fast recovery mode disabled
...@@ -149,16 +152,16 @@ static uint8_t prev; ...@@ -149,16 +152,16 @@ static uint8_t prev;
static void clear(void) static void clear(void)
{ {
Paint_Clear(BLACK); gfx_clear(&display_screen);
prev = Y_OFFSET; prev = Y_OFFSET;
} }
static void set(uint8_t index, int8_t val) static void set(uint8_t index, int8_t val)
{ {
if (val < -Y_SCALE)
if(val < -Y_SCALE) val = -Y_SCALE; val = -Y_SCALE;
if(val > Y_SCALE) val = Y_SCALE; if (val > Y_SCALE)
val = Y_SCALE;
int8_t pos = Y_OFFSET + val; int8_t pos = Y_OFFSET + val;
...@@ -172,7 +175,7 @@ static void set(uint8_t index, int8_t val) ...@@ -172,7 +175,7 @@ static void set(uint8_t index, int8_t val)
} }
for (int i = min; i < max + 1; i++) { for (int i = min; i < max + 1; i++) {
LCD_SetUWORD(SIZE_X - index - 1, i, RED); LCD_SetUWORD(SIZE_X - index - 1, i, 0xf800);
} }
prev = pos; prev = pos;
...@@ -193,9 +196,20 @@ void update(void) ...@@ -193,9 +196,20 @@ void update(void)
int16_t scale = max / Y_SCALE + 1; int16_t scale = max / Y_SCALE + 1;
char buf[128]; char buf[128];
sprintf(buf, "Switch: %d Pull: %d Scale: %d", ecg_switch, internal_pull, scale); sprintf(buf,
Paint_DrawString_EN(0, 0, buf, &Font8, 0x0000, 0xffff); "Switch: %d Pull: %d Scale: %d",
ecg_switch,
internal_pull,
scale);
gfx_puts(
&Font8,
&display_screen,
0,
0,
buf,
gfx_color(&display_screen, WHITE),
gfx_color(&display_screen, BLACK)
);
for (int i = 0; i < SIZE_X; i++) { for (int i = 0; i < SIZE_X; i++) {
set(i, (samples[i] / scale)); set(i, (samples[i] / scale));
...@@ -274,76 +288,41 @@ sampling frequency: 200 Hz ...@@ -274,76 +288,41 @@ sampling frequency: 200 Hz
#define FILTER_TAP_NUM 71 #define FILTER_TAP_NUM 71
static double filter_taps[FILTER_TAP_NUM] = { static double filter_taps[FILTER_TAP_NUM] = {
0.0057445089465822975, 0.0057445089465822975, 0.007451288673767406,
0.007451288673767406, -0.0011523652638272097, -0.0030609271459832005,
-0.0011523652638272097, -0.002596310763437956, 0.004452951934981218,
-0.0030609271459832005, 0.003740429140762826, -0.002351310203707235,
-0.002596310763437956, -0.00638990322759006, 0.000013108391204023357,
0.004452951934981218, 0.007226767366250225, 0.003994033360879168,
0.003740429140762826, -0.00665189327484351, -0.008058131222070393,
-0.002351310203707235, 0.0035814528837470965, 0.011450459869389184,
-0.00638990322759006, 0.0016796020911726648, -0.012657785603199918,
0.000013108391204023357, -0.008611714082779583, 0.010587105712461298,
0.007226767366250225, 0.01581354994840992, -0.0044174953741535905,
0.003994033360879168, -0.021419548904285074, -0.005927897725436821,
-0.00665189327484351, 0.023159558089340265, 0.01973520678092361,
-0.008058131222070393, -0.018604692334579287, -0.035495574517452874,
0.0035814528837470965, 0.004958680854279203, 0.05116349477789529,
0.011450459869389184, 0.02244341207607204, -0.06449371846227892,
0.0016796020911726648, -0.0790927656214483, 0.07342794634140555,
-0.012657785603199918, 0.3089023630319309, 0.42341742792869774,
-0.008611714082779583, 0.3089023630319309, 0.07342794634140555,
0.010587105712461298, -0.0790927656214483, -0.06449371846227892,
0.01581354994840992, 0.02244341207607204, 0.05116349477789529,
-0.0044174953741535905, 0.004958680854279203, -0.035495574517452874,
-0.021419548904285074, -0.018604692334579287, 0.01973520678092361,
-0.005927897725436821, 0.023159558089340265, -0.005927897725436821,
0.023159558089340265, -0.021419548904285074, -0.0044174953741535905,
0.01973520678092361, 0.01581354994840992, 0.010587105712461298,
-0.018604692334579287, -0.008611714082779583, -0.012657785603199918,
-0.035495574517452874, 0.0016796020911726648, 0.011450459869389184,
0.004958680854279203, 0.0035814528837470965, -0.008058131222070393,
0.05116349477789529, -0.00665189327484351, 0.003994033360879168,
0.02244341207607204, 0.007226767366250225, 0.000013108391204023357,
-0.06449371846227892, -0.00638990322759006, -0.002351310203707235,
-0.0790927656214483, 0.003740429140762826, 0.004452951934981218,
0.07342794634140555, -0.002596310763437956, -0.0030609271459832005,
0.3089023630319309, -0.0011523652638272097, 0.007451288673767406,
0.42341742792869774,
0.3089023630319309,
0.07342794634140555,
-0.0790927656214483,
-0.06449371846227892,
0.02244341207607204,
0.05116349477789529,
0.004958680854279203,
-0.035495574517452874,
-0.018604692334579287,
0.01973520678092361,
0.023159558089340265,
-0.005927897725436821,
-0.021419548904285074,
-0.0044174953741535905,
0.01581354994840992,
0.010587105712461298,
-0.008611714082779583,
-0.012657785603199918,
0.0016796020911726648,
0.011450459869389184,
0.0035814528837470965,
-0.008058131222070393,
-0.00665189327484351,
0.003994033360879168,
0.007226767366250225,
0.000013108391204023357,
-0.00638990322759006,
-0.002351310203707235,
0.003740429140762826,
0.004452951934981218,
-0.002596310763437956,
-0.0030609271459832005,
-0.0011523652638272097,
0.007451288673767406,
0.0057445089465822975 0.0057445089465822975
}; };
#endif #endif
...@@ -376,28 +355,31 @@ static void add_sample(int16_t sample) ...@@ -376,28 +355,31 @@ static void add_sample(int16_t sample)
} }
static volatile bool ecgFIFOIntFlag = false; static volatile bool ecgFIFOIntFlag = false;
static void ecgFIFO_callback(void *data) { static void ecgFIFO_callback(void *data)
{
ecgFIFOIntFlag = true; ecgFIFOIntFlag = true;
} }
// ***************************************************************************** // *****************************************************************************
int main(void) int main(void)
{ {
card10_init(); card10_init();
card10_diag(); card10_diag();
const gpio_cfg_t interrupt_pin = {PORT_1, PIN_12, GPIO_FUNC_IN, GPIO_PAD_PULL_UP}; const gpio_cfg_t interrupt_pin = {
PORT_1, PIN_12, GPIO_FUNC_IN, GPIO_PAD_PULL_UP
};
GPIO_Config(&interrupt_pin); GPIO_Config(&interrupt_pin);
GPIO_RegisterCallback(&interrupt_pin, ecgFIFO_callback, NULL); GPIO_RegisterCallback(&interrupt_pin, ecgFIFO_callback, NULL);
GPIO_IntConfig(&interrupt_pin, GPIO_INT_EDGE, GPIO_INT_FALLING); GPIO_IntConfig(&interrupt_pin, GPIO_INT_EDGE, GPIO_INT_FALLING);
GPIO_IntEnable(&interrupt_pin); GPIO_IntEnable(&interrupt_pin);
NVIC_EnableIRQ(MXC_GPIO_GET_IRQ(PORT_1)); NVIC_EnableIRQ(MXC_GPIO_GET_IRQ(PORT_1));
const gpio_cfg_t analog_switch = {PORT_0, PIN_31, GPIO_FUNC_OUT, GPIO_PAD_NONE}; const gpio_cfg_t analog_switch = {
PORT_0, PIN_31, GPIO_FUNC_OUT, GPIO_PAD_NONE
};
GPIO_Config(&analog_switch); GPIO_Config(&analog_switch);
ecg_switch = false; ecg_switch = false;
GPIO_OutClr(&analog_switch); // Wrist GPIO_OutClr(&analog_switch); // Wrist
...@@ -417,16 +399,13 @@ int main(void) ...@@ -417,16 +399,13 @@ int main(void)
max86150_setup(0x1F, 4, 3, 400, 411, 4096); max86150_setup(0x1F, 4, 3, 400, 411, 4096);
#endif #endif
uint32_t ecgFIFO, readECGSamples, idx, ETAG[32], status; uint32_t ecgFIFO, readECGSamples, idx, ETAG[32], status;
int16_t ecgSample[32]; int16_t ecgSample[32];
const int EINT_STATUS_MASK = 1 << 23; const uint32_t EINT_STATUS_MASK = 1 << 23;
const int FIFO_OVF_MASK = 0x7; const uint32_t FIFO_OVF_MASK = 0x7;
const int FIFO_VALID_SAMPLE_MASK = 0x0; const uint32_t FIFO_VALID_SAMPLE_MASK = 0x0;
const int FIFO_FAST_SAMPLE_MASK = 0x1; const uint32_t FIFO_FAST_SAMPLE_MASK = 0x1;
const int ETAG_BITS_MASK = 0x7; const uint32_t ETAG_BITS_MASK = 0x7;
while (1) { while (1) {
#if 1 #if 1
...@@ -436,7 +415,8 @@ int main(void) ...@@ -436,7 +415,8 @@ int main(void)
if (PB_Get(3)) { if (PB_Get(3)) {
ecg_switch = !ecg_switch; ecg_switch = !ecg_switch;
while(PB_Get(0)); while (PB_Get(0))
;
if (ecg_switch) { if (ecg_switch) {
GPIO_OutSet(&analog_switch); // USB GPIO_OutSet(&analog_switch); // USB
} else { } else {
...@@ -446,31 +426,40 @@ int main(void) ...@@ -446,31 +426,40 @@ int main(void)
if (PB_Get(4)) { if (PB_Get(4)) {
internal_pull = !internal_pull; internal_pull = !internal_pull;
while(PB_Get(2)); while (PB_Get(2))
;
ecg_config(internal_pull); ecg_config(internal_pull);
} }
//printf("Int\n"); //printf("Int\n");
status = ecg_read_reg( STATUS ); // Read the STATUS register status = ecg_read_reg(
STATUS); // Read the STATUS register
// Check if EINT interrupt asserted // Check if EINT interrupt asserted
if ((status & EINT_STATUS_MASK) == EINT_STATUS_MASK) { if ((status & EINT_STATUS_MASK) == EINT_STATUS_MASK) {
readECGSamples = 0; // Reset sample counter readECGSamples = 0; // Reset sample counter
do { do {
ecgFIFO = ecg_read_reg(ECG_FIFO ); // Read FIFO ecgFIFO = ecg_read_reg(
ecgSample[readECGSamples] = ecgFIFO >> 8; // Isolate voltage data ECG_FIFO); // Read FIFO
ETAG[readECGSamples] = ( ecgFIFO >> 3 ) & ETAG_BITS_MASK; // Isolate ETAG ecgSample[readECGSamples] =
ecgFIFO >>
8; // Isolate voltage data
ETAG[readECGSamples] =
(ecgFIFO >> 3) &
ETAG_BITS_MASK; // Isolate ETAG
readECGSamples++; // Increment sample counter readECGSamples++; // Increment sample counter
// Check that sample is not last sample in FIFO // Check that sample is not last sample in FIFO
} while ( ETAG[readECGSamples-1] == FIFO_VALID_SAMPLE_MASK || } while (ETAG[readECGSamples - 1] ==
ETAG[readECGSamples-1] == FIFO_FAST_SAMPLE_MASK ); FIFO_VALID_SAMPLE_MASK ||
ETAG[readECGSamples - 1] ==
FIFO_FAST_SAMPLE_MASK);
// Check if FIFO has overflowed // Check if FIFO has overflowed
if (ETAG[readECGSamples - 1] == FIFO_OVF_MASK) { if (ETAG[readECGSamples - 1] == FIFO_OVF_MASK) {
ecg_write_reg(FIFO_RST , 0); // Reset FIFO ecg_write_reg(
FIFO_RST, 0); // Reset FIFO
//printf("OV\n"); //printf("OV\n");
// notifies the user that an over flow occured // notifies the user that an over flow occured
//LED_On(0); //LED_On(0);
......
file ../../build/hw-tests/hello-freertos/hello-freertos.elf
source ../../.gdbinit
source ../../init.gdb
file ../../build/hw-tests/hello-freertos/hello-freertos.elf
...@@ -187,7 +187,8 @@ void vTickTockTask(void *pvParameters) ...@@ -187,7 +187,8 @@ void vTickTockTask(void *pvParameters)
while (1) { while (1) {
ticks = xTaskGetTickCount(); ticks = xTaskGetTickCount();
printf("Uptime is 0x%08lx (%lu seconds), tickless-idle is %s\n", printf("Uptime is 0x%08lx (%lu seconds), tickless-idle is %s\n",
ticks, ticks / configTICK_RATE_HZ, ticks,
ticks / configTICK_RATE_HZ,
disable_tickless ? "disabled" : "ENABLED"); disable_tickless ? "disabled" : "ENABLED");
vTaskDelayUntil(&xLastWakeTime, (configTICK_RATE_HZ * 60)); vTaskDelayUntil(&xLastWakeTime, (configTICK_RATE_HZ * 60));
} }
...@@ -274,7 +275,8 @@ void vCmdLineTask(void *pvParameters) ...@@ -274,7 +275,8 @@ void vCmdLineTask(void *pvParameters)
fflush(stdout); fflush(stdout);
while (1) { while (1) {
/* Register async read request */ /* Register async read request */
if (UART_ReadAsync(ConsoleUART, &async_read_req) != E_NO_ERROR) { if (UART_ReadAsync(ConsoleUART, &async_read_req) !=
E_NO_ERROR) {
printf("Error registering async request. Command line unavailable.\n"); printf("Error registering async request. Command line unavailable.\n");
vTaskDelay(portMAX_DELAY); vTaskDelay(portMAX_DELAY);
} }
...@@ -297,18 +299,26 @@ void vCmdLineTask(void *pvParameters) ...@@ -297,18 +299,26 @@ void vCmdLineTask(void *pvParameters)
printf("^C"); printf("^C");
printf("\ncmd> "); printf("\ncmd> ");
fflush(stdout); fflush(stdout);
} else if ((tmp == '\r') || } else if ((tmp == '\r') || (tmp == '\n')) {
(tmp == '\n')) {
printf("\r\n"); printf("\r\n");
/* Null terminate for safety */ /* Null terminate for safety */
buffer[index] = 0x00; buffer[index] = 0x00;
/* Evaluate */ /* Evaluate */
do { do {
xMore = FreeRTOS_CLIProcessCommand(buffer, output, OUTPUT_BUF_SIZE); xMore = FreeRTOS_CLIProcessCommand(
buffer,
output,
OUTPUT_BUF_SIZE
);
/* If xMore == pdTRUE, then output buffer contains no null termination, so /* If xMore == pdTRUE, then output buffer contains no null termination, so
* we know it is OUTPUT_BUF_SIZE. If pdFALSE, we can use strlen. * we know it is OUTPUT_BUF_SIZE. If pdFALSE, we can use strlen.
*/ */
for (x = 0; x < (xMore == pdTRUE ? OUTPUT_BUF_SIZE : strlen(output)) ; x++) { for (x = 0;
x <
(xMore == pdTRUE ?
OUTPUT_BUF_SIZE :
strlen(output));
x++) {
putchar(*(output + x)); putchar(*(output + x));
} }
} while (xMore != pdFALSE); } while (xMore != pdFALSE);
...@@ -326,8 +336,14 @@ void vCmdLineTask(void *pvParameters) ...@@ -326,8 +336,14 @@ void vCmdLineTask(void *pvParameters)
fflush(stdout); fflush(stdout);
} }
/* If more characters are ready, process them here */ /* If more characters are ready, process them here */
} while ((UART_NumReadAvail(MXC_UART_GET_UART(CONSOLE_UART)) > 0) && } while ((UART_NumReadAvail(MXC_UART_GET_UART(
UART_Read(MXC_UART_GET_UART(CONSOLE_UART), (uint8_t *)&tmp, 1, NULL)); CONSOLE_UART)) > 0) &&
UART_Read(
MXC_UART_GET_UART(CONSOLE_UART),
(uint8_t *)&tmp,
1,
NULL)
);
} }
} }
} }
...@@ -365,15 +381,13 @@ void RTC_IRQHandler(void) ...@@ -365,15 +381,13 @@ void RTC_IRQHandler(void)
int main(void) int main(void)
{ {
#if configUSE_TICKLESS_IDLE #if configUSE_TICKLESS_IDLE
uart_cfg_t uart_cfg = { uart_cfg_t uart_cfg = { .parity = UART_PARITY_DISABLE,
.parity = UART_PARITY_DISABLE,
.size = UART_DATA_SIZE_8_BITS, .size = UART_DATA_SIZE_8_BITS,
.stop = UART_STOP_1, .stop = UART_STOP_1,
.flow = UART_FLOW_CTRL_DIS, .flow = UART_FLOW_CTRL_DIS,
.pol = UART_FLOW_POL_DIS, .pol = UART_FLOW_POL_DIS,
.baud = 115200, .baud = 115200,
.clksel = UART_CLKSEL_SYSTEM .clksel = UART_CLKSEL_SYSTEM };
};
sys_cfg_uart_t uart_sys_cfg = { MAP_A, Enable }; sys_cfg_uart_t uart_sys_cfg = { MAP_A, Enable };
/* The RTC must be enabled for tickless operation */ /* The RTC must be enabled for tickless operation */
...@@ -389,7 +403,9 @@ int main(void) ...@@ -389,7 +403,9 @@ int main(void)
#endif #endif
/* Print banner (RTOS scheduler not running) */ /* Print banner (RTOS scheduler not running) */
printf("\n-=- %s FreeRTOS (%s) Demo -=-\n", STRING(TARGET), tskKERNEL_VERSION_NUMBER); printf("\n-=- %s FreeRTOS (%s) Demo -=-\n",
STRING(TARGET),
tskKERNEL_VERSION_NUMBER);
#if configUSE_TICKLESS_IDLE #if configUSE_TICKLESS_IDLE
printf("Tickless idle is configured. Type 'tickless 1' to enable.\n"); printf("Tickless idle is configured. Type 'tickless 1' to enable.\n");
#endif #endif
...@@ -400,14 +416,35 @@ int main(void) ...@@ -400,14 +416,35 @@ int main(void)
printf("xSemaphoreCreateMutex failed to create a mutex.\n"); printf("xSemaphoreCreateMutex failed to create a mutex.\n");
} else { } else {
/* Configure task */ /* Configure task */
if ((xTaskCreate(vTask0, (const char *)"Task0", if ((xTaskCreate(
configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, NULL) != pdPASS) || vTask0,
(xTaskCreate(vTask1, (const char *)"Task1", (const char *)"Task0",
configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, NULL) != pdPASS) || configMINIMAL_STACK_SIZE,
(xTaskCreate(vTickTockTask, (const char *)"TickTock", NULL,
2*configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+2, NULL) != pdPASS) || tskIDLE_PRIORITY + 1,
(xTaskCreate(vCmdLineTask, (const char *)"CmdLineTask", NULL) != pdPASS) ||
configMINIMAL_STACK_SIZE+CMD_LINE_BUF_SIZE+OUTPUT_BUF_SIZE, NULL, tskIDLE_PRIORITY+1, &cmd_task_id) != pdPASS)) { (xTaskCreate(
vTask1,
(const char *)"Task1",
configMINIMAL_STACK_SIZE,
NULL,
tskIDLE_PRIORITY + 1,
NULL) != pdPASS) ||
(xTaskCreate(
vTickTockTask,
(const char *)"TickTock",
2 * configMINIMAL_STACK_SIZE,
NULL,
tskIDLE_PRIORITY + 2,
NULL) != pdPASS) ||
(xTaskCreate(
vCmdLineTask,
(const char *)"CmdLineTask",
configMINIMAL_STACK_SIZE + CMD_LINE_BUF_SIZE +
OUTPUT_BUF_SIZE,
NULL,
tskIDLE_PRIORITY + 1,
&cmd_task_id) != pdPASS)) {
printf("xTaskCreate() failed to create a task.\n"); printf("xTaskCreate() failed to create a task.\n");
} else { } else {
/* Start scheduler */ /* Start scheduler */
......
file ../../build/hw-tests/hello-world/hello-world.elf
source ../../.gdbinit
source ../../init.gdb
file ../../build/hw-tests/hello-world/hello-world.elf
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
#include "leds.h" #include "leds.h"
#include "card10.h" #include "card10.h"
#include "GUI_Paint.h" #include "gfx.h"
#include "display.h"
#include "tmr_utils.h" #include "tmr_utils.h"
...@@ -19,7 +20,8 @@ ...@@ -19,7 +20,8 @@
/***** Definitions *****/ /***** Definitions *****/
/***** Globals *****/ /***** Globals *****/
static __attribute__((unused)) const gpio_cfg_t motor_pin = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE}; static __attribute__((unused))
const gpio_cfg_t motor_pin = { PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE };
int main(void) int main(void)
{ {
...@@ -28,11 +30,19 @@ int main(void) ...@@ -28,11 +30,19 @@ int main(void)
card10_init(); card10_init();
card10_diag(); card10_diag();
Paint_DrawImage(Heart, 0, 0, 160, 80); gfx_copy_region(
LCD_Update(); &display_screen,
0,
0,
160,
80,
GFX_RGB565,
(const void *)(Heart)
);
gfx_update(&display_screen);
for (int i = 0; i < 11; i++) { for (int i = 0; i < 11; i++) {
leds_set_dim(i, 1); // leds_set_dim(i, 1);
} }
int __attribute__((unused)) h = 0; int __attribute__((unused)) h = 0;
......
file ../../build/hw-tests/imutest/imutest.elf
source ../../.gdbinit
source ../../init.gdb
file ../../build/hw-tests/imutest/imutest.elf