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
  • add_menu_vibration
  • blinkisync-as-preload
  • ch3/api-speed-eval2
  • ch3/dual-core
  • ch3/genapi-refactor
  • ch3/leds-api
  • ch3/splashscreen
  • dualcore
  • dx/flatten-config-module
  • dx/meh-bdf-to-stm
  • freertos-btle
  • genofire/ble-follow-py
  • koalo/bhi160-works-but-dirty
  • koalo/factory-reset
  • koalo/wip/i2c-for-python
  • master
  • msgctl/faultscreen
  • msgctl/textbuffer_api
  • plaetzchen/ios-workaround
  • rahix/bhi
  • rahix/bluetooth-app-favorite
  • rahix/bma
  • rahix/user-space-ctx
  • renze/hatchery_apps
  • renze/safe_mode
  • schleicher-test
  • schneider/212-reset-hardware-when-entering-repl
  • schneider/ancs
  • schneider/ble-buffers
  • schneider/ble-central
  • schneider/ble-ecg-stream-visu
  • schneider/ble-fixes-2020-3
  • schneider/ble-mini-demo
  • schneider/ble-stability
  • schneider/ble-stability-new-phy
  • schneider/bonding
  • schneider/bonding-fail-if-full
  • schneider/bootloader-update-9a0d158
  • schneider/deepsleep
  • schneider/deepsleep2
  • schneider/deepsleep4
  • schneider/default-main
  • schneider/freertos-list-debug
  • schneider/fundamental-test
  • schneider/iaq-python
  • schneider/ir
  • schneider/max30001
  • schneider/max30001-epicaridum
  • schneider/max30001-pycardium
  • schneider/maxim-sdk-update
  • schneider/mp-exception-print
  • schneider/mp-for-old-bl
  • schneider/png
  • schneider/schleicher-test
  • schneider/sdk-0.2.1-11
  • schneider/sdk-0.2.1-7
  • schneider/sleep-display
  • schneider/spo2-playground
  • schneider/stream-locks
  • schneider/v1.17-changelog
  • bootloader-v1
  • release-1
  • v0.0
  • v1.0
  • v1.1
  • v1.10
  • v1.11
  • v1.12
  • v1.13
  • v1.14
  • v1.15
  • v1.16
  • v1.17
  • v1.18
  • v1.2
  • v1.3
  • v1.4
  • v1.5
  • v1.6
  • v1.7
  • v1.8
  • v1.9
82 results

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
  • blinkisync-as-preload
  • ch3/api-speed-eval2
  • ch3/dual-core
  • ch3/genapi-refactor
  • ch3/leds-api
  • ch3/splashscreen
  • drawcall_clipping
  • dualcore
  • faulty_unsigned_comparisons
  • freertos-btle
  • fuchsi-ecg-app
  • genofire/ble-follow-py
  • genofire/haule-ble-fs-deactive
  • genofire/leds_rgb_get_state
  • genofire/rockets-state
  • gpio_in_adc_fix
  • ios-workarounds
  • koalo/bhi160-works-but-dirty
  • koalo/factory-reset
  • koalo/wip/i2c-for-python
  • master
  • msgctl/faultscreen
  • msgctl/gfx_rle
  • msgctl/textbuffer_api
  • plaetzchen/ios-workaround
  • rahix/bhi
  • rahix/bma
  • renze/hatchery_apps
  • renze/safe_mode
  • schleicher-test
  • schneider/ble-buffers
  • schneider/bonding
  • schneider/bootloader-update-9a0d158
  • schneider/bsec
  • schneider/fundamental-test
  • schneider/max30001
  • schneider/max30001-epicaridum
  • schneider/max30001-pycardium
  • schneider/maxim-sdk-update
  • schneider/mp-for-old-bl
  • schneider/schleicher-test
  • schneider/stream-locks
  • bootloader-v1
  • release-1
  • v0.0
  • v1.0
  • v1.1
  • v1.2
  • v1.3
  • v1.4
  • v1.5
  • v1.6
  • v1.7
  • v1.8
  • v1.9
55 results
Show changes
Showing
with 929 additions and 882 deletions
......@@ -64,7 +64,6 @@ int main(void)
uint32_t poll_period = 5, test_dur_ms = 30000;
uint16_t int_status;
bma.intf_ptr = NULL; /* To attach your interface device reference */
bma.delay_ms = card10_bosch_delay;
bma.dev_id = BMA400_I2C_ADDRESS_SDO_LOW;
......@@ -77,7 +76,6 @@ int main(void)
printf("BMA400 found with chip ID 0x%X\r\n", bma.chip_id);
}
print_rslt(rslt);
rslt = bma400_soft_reset(&bma);
......@@ -138,6 +136,5 @@ int main(void)
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 @@
#include "gpio.h"
#include "bme680.h"
#include "bosch.h"
#include "GUI_DEV/GUI_Paint.h"
#include "gfx.h"
#include "framebuffer.h"
#include "display.h"
#include "Fonts/fonts.h"
#include "card10.h"
......@@ -63,8 +65,9 @@ int main(void)
gas_sensor.power_mode = BME680_FORCED_MODE;
/* Set the required sensor settings needed */
set_required_settings = BME680_OST_SEL | BME680_OSP_SEL | BME680_OSH_SEL | BME680_FILTER_SEL
| BME680_GAS_SENSOR_SEL;
set_required_settings = BME680_OST_SEL | BME680_OSP_SEL |
BME680_OSH_SEL | BME680_FILTER_SEL |
BME680_GAS_SENSOR_SEL;
/* Set the desired sensor configuration */
rslt = bme680_set_sensor_settings(set_required_settings, &gas_sensor);
......@@ -72,25 +75,28 @@ int main(void)
/* Set the power mode */
rslt = bme680_set_sensor_mode(&gas_sensor);
Color white = gfx_color(&display_screen, WHITE);
Color black = gfx_color(&display_screen, BLACK);
while (1) {
TMR_Delay(MXC_TMR0, MSEC(1000), 0);
struct bme680_field_data data;
rslt = bme680_get_sensor_data(&data, &gas_sensor);
printf("T: %.2Lf degC, P: %.2Lf hPa, H %.2Lf %%rH ", data.temperature / 100.0l,
data.pressure / 100.0l, data.humidity / 1000.0l );
printf("T: %.2Lf degC, P: %.2Lf hPa, H %.2Lf %%rH ",
data.temperature / 100.0l,
data.pressure / 100.0l,
data.humidity / 1000.0l);
char buf[128];
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);
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);
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,
// data.pressure / 100.0f, data.humidity / 1000.0f );
......@@ -98,10 +104,18 @@ int main(void)
if (data.status & BME680_GASM_VALID_MSK) {
printf(", 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");
......
......@@ -6,10 +6,9 @@
#include "card10.h"
#include "bootloader-9251ea6.h"
#include "display.h"
#include "GUI_Paint.h"
#include "gfx.h"
#include "pmic.h"
#include "flc.h"
#include "icc.h"
#include "tmr_utils.h"
......@@ -37,45 +36,43 @@ static void pmic_button(bool falling)
}
}
int main(void)
{
card10_init();
pmic_set_button_callback(pmic_button);
printf("Erasing bootloader.\n");
Paint_DrawString_EN(0, 16*0, "Erasing bootloader", &Font16, 0x0000, 0xffff);
LCD_Update();
txt_puts(&display_textb, "Erasing bootloader.\n");
ICC_Disable();
int ret = FLC_MultiPageErase(0x10000000, 0x10000000 + 1024 * 64 - 1);
if (ret != E_NO_ERROR) {
printf("FLC_MultiPageErase failed with %d\n", ret);
Paint_DrawString_EN(0, 16*1, "Fail.", &Font16, 0x0000, 0xffff);
LCD_Update();
while(1);
txt_puts(&display_textb, "Fail.\n");
while (1)
;
}
printf("Writing bootloader.\n");
Paint_DrawString_EN(0, 16*0, "Writing bootloader ", &Font16, 0x0000, 0xffff);
LCD_Update();
txt_puts(&display_textb, "Writing bootloader.\n");
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) {
printf("FLC_Write failed with %d\n", ret);
Paint_DrawString_EN(0, 16*1, "Fail.", &Font16, 0x0000, 0xffff);
LCD_Update();
while(1);
txt_puts(&display_textb, "Fail.\n");
while (1)
;
}
ICC_Enable();
printf("Done.\n");
Paint_DrawString_EN(0, 16*1, "Done.", &Font16, 0x0000, 0xffff);
Paint_DrawString_EN(0, 16*2, "Please restart", &Font16, 0x0000, 0xffff);
LCD_Update();
txt_puts(&display_textb, "Done.\n");
txt_puts(&display_textb, "Please restart.\n");
while (1) {
card10_poll();
......
......@@ -2,7 +2,8 @@
#include "gpio.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)
{
......
source ../../.gdbinit
source ../../init.gdb
set confirm off
......
......@@ -3,45 +3,42 @@
******************************************************************************/
/***** Includes *****/
#include "pmic.h"
#include "leds.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 <stdio.h>
#include <Heart.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <Heart.h>
int main(void)
{
card10_init();
card10_diag();
Paint_DrawImage(Heart, 0, 0, 160, 80);
LCD_Update();
for(int i=0; i<11; i++) {
leds_set_dim(i, 1);
}
int h = 0;
gfx_copy_region(
&display_screen,
0,
0,
160,
80,
GFX_RGB565,
(const void *)(Heart)
);
gfx_update(&display_screen);
// Release core1
core1_start();
core1_start((void *)0x10080000);
int h = 0;
while (1) {
#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();
TMR_Delay(MXC_TMR0, MSEC(10), 0);
......
......@@ -3,7 +3,7 @@ executable(
name + '.elf',
'main.c',
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: [
'-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
],
......@@ -14,7 +14,7 @@ executable(
name + '.elf',
'core1.c',
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: [
'-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 @@
#include "spi.h"
#include "pb.h"
#include "MAX30003.h"
#include "GUI_DEV/GUI_Paint.h"
#include "gfx.h"
#include "LCD_Driver.h"
#include "display.h"
#include "pmic.h"
#include "card10.h"
#include <stdbool.h>
......@@ -56,7 +58,9 @@ static void ecg_write_reg(uint8_t reg, uint32_t data)
{
printf("write %02x %06lx\n", reg, data);
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 };
req.tx_data = tx_data;
req.rx_data = rx_data;
......@@ -81,12 +85,16 @@ static void ecg_config(bool enable_internal_pull)
union GeneralConfiguration_u CNFG_GEN_r;
CNFG_GEN_r.bits.en_ecg = 1; // Enable ECG channel
if (enable_internal_pull) {
CNFG_GEN_r.bits.rbiasn = 1; // Enable resistive bias on negative input
CNFG_GEN_r.bits.rbiasp = 1; // Enable resistive bias on positive input
CNFG_GEN_r.bits.rbiasn =
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
} else {
CNFG_GEN_r.bits.rbiasn = 0; // Enable resistive bias on negative input
CNFG_GEN_r.bits.rbiasp = 0; // Enable resistive bias on positive input
CNFG_GEN_r.bits.rbiasn =
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
}
......@@ -94,7 +102,6 @@ static void ecg_config(bool enable_internal_pull)
CNFG_GEN_r.bits.en_dcloff = 1; // Enable DC lead-off detection
ecg_write_reg(CNFG_GEN, CNFG_GEN_r.all);
// ECG Config register setting
union ECGConfiguration_u CNFG_ECG_r;
CNFG_ECG_r.bits.dlpf = 1; // Digital LPF cutoff = 40Hz
......@@ -105,20 +112,17 @@ static void ecg_config(bool enable_internal_pull)
//CNFG_ECG_r.bits.rate = 1; // Sample rate = 256 sps
ecg_write_reg(CNFG_ECG, CNFG_ECG_r.all);
//R-to-R configuration
union RtoR1Configuration_u CNFG_RTOR_r;
CNFG_RTOR_r.bits.en_rtor = 1; // Enable R-to-R detection
ecg_write_reg(CNFG_RTOR1, CNFG_RTOR_r.all);
//Manage interrupts register setting
union ManageInterrupts_u MNG_INT_r;
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
ecg_write_reg(MNGR_INT, MNG_INT_r.all);
//Enable interrupts register setting
union EnableInterrupts_u EN_INT_r;
EN_INT_r.all = 0;
......@@ -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
ecg_write_reg(EN_INT, EN_INT_r.all);
//Dyanmic modes config
union ManageDynamicModes_u MNG_DYN_r;
MNG_DYN_r.bits.fast = 0; // Fast recovery mode disabled
......@@ -149,16 +152,16 @@ static uint8_t prev;
static void clear(void)
{
Paint_Clear(BLACK);
gfx_clear(&display_screen);
prev = Y_OFFSET;
}
static void set(uint8_t index, int8_t val)
{
if(val < -Y_SCALE) val = -Y_SCALE;
if(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;
......@@ -172,7 +175,7 @@ static void set(uint8_t index, int8_t val)
}
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;
......@@ -193,9 +196,20 @@ void update(void)
int16_t scale = max / Y_SCALE + 1;
char buf[128];
sprintf(buf, "Switch: %d Pull: %d Scale: %d", ecg_switch, internal_pull, scale);
Paint_DrawString_EN(0, 0, buf, &Font8, 0x0000, 0xffff);
sprintf(buf,
"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++) {
set(i, (samples[i] / scale));
......@@ -274,76 +288,41 @@ sampling frequency: 200 Hz
#define FILTER_TAP_NUM 71
static double filter_taps[FILTER_TAP_NUM] = {
0.0057445089465822975,
0.007451288673767406,
-0.0011523652638272097,
-0.0030609271459832005,
-0.002596310763437956,
0.004452951934981218,
0.003740429140762826,
-0.002351310203707235,
-0.00638990322759006,
0.000013108391204023357,
0.007226767366250225,
0.003994033360879168,
-0.00665189327484351,
-0.008058131222070393,
0.0035814528837470965,
0.011450459869389184,
0.0016796020911726648,
-0.012657785603199918,
-0.008611714082779583,
0.010587105712461298,
0.01581354994840992,
-0.0044174953741535905,
-0.021419548904285074,
-0.005927897725436821,
0.023159558089340265,
0.01973520678092361,
-0.018604692334579287,
-0.035495574517452874,
0.004958680854279203,
0.05116349477789529,
0.02244341207607204,
-0.06449371846227892,
-0.0790927656214483,
0.07342794634140555,
0.3089023630319309,
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.007451288673767406,
-0.0011523652638272097, -0.0030609271459832005,
-0.002596310763437956, 0.004452951934981218,
0.003740429140762826, -0.002351310203707235,
-0.00638990322759006, 0.000013108391204023357,
0.007226767366250225, 0.003994033360879168,
-0.00665189327484351, -0.008058131222070393,
0.0035814528837470965, 0.011450459869389184,
0.0016796020911726648, -0.012657785603199918,
-0.008611714082779583, 0.010587105712461298,
0.01581354994840992, -0.0044174953741535905,
-0.021419548904285074, -0.005927897725436821,
0.023159558089340265, 0.01973520678092361,
-0.018604692334579287, -0.035495574517452874,
0.004958680854279203, 0.05116349477789529,
0.02244341207607204, -0.06449371846227892,
-0.0790927656214483, 0.07342794634140555,
0.3089023630319309, 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
};
#endif
......@@ -376,28 +355,31 @@ static void add_sample(int16_t sample)
}
static volatile bool ecgFIFOIntFlag = false;
static void ecgFIFO_callback(void *data) {
static void ecgFIFO_callback(void *data)
{
ecgFIFOIntFlag = true;
}
// *****************************************************************************
int main(void)
{
card10_init();
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_RegisterCallback(&interrupt_pin, ecgFIFO_callback, NULL);
GPIO_IntConfig(&interrupt_pin, GPIO_INT_EDGE, GPIO_INT_FALLING);
GPIO_IntEnable(&interrupt_pin);
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);
ecg_switch = false;
GPIO_OutClr(&analog_switch); // Wrist
......@@ -417,16 +399,13 @@ int main(void)
max86150_setup(0x1F, 4, 3, 400, 411, 4096);
#endif
uint32_t ecgFIFO, readECGSamples, idx, ETAG[32], status;
int16_t ecgSample[32];
const int EINT_STATUS_MASK = 1 << 23;
const int FIFO_OVF_MASK = 0x7;
const int FIFO_VALID_SAMPLE_MASK = 0x0;
const int FIFO_FAST_SAMPLE_MASK = 0x1;
const int ETAG_BITS_MASK = 0x7;
const uint32_t EINT_STATUS_MASK = 1 << 23;
const uint32_t FIFO_OVF_MASK = 0x7;
const uint32_t FIFO_VALID_SAMPLE_MASK = 0x0;
const uint32_t FIFO_FAST_SAMPLE_MASK = 0x1;
const uint32_t ETAG_BITS_MASK = 0x7;
while (1) {
#if 1
......@@ -436,7 +415,8 @@ int main(void)
if (PB_Get(3)) {
ecg_switch = !ecg_switch;
while(PB_Get(0));
while (PB_Get(0))
;
if (ecg_switch) {
GPIO_OutSet(&analog_switch); // USB
} else {
......@@ -446,31 +426,40 @@ int main(void)
if (PB_Get(4)) {
internal_pull = !internal_pull;
while(PB_Get(2));
while (PB_Get(2))
;
ecg_config(internal_pull);
}
//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
if ((status & EINT_STATUS_MASK) == EINT_STATUS_MASK) {
readECGSamples = 0; // Reset sample counter
do {
ecgFIFO = ecg_read_reg(ECG_FIFO ); // Read FIFO
ecgSample[readECGSamples] = ecgFIFO >> 8; // Isolate voltage data
ETAG[readECGSamples] = ( ecgFIFO >> 3 ) & ETAG_BITS_MASK; // Isolate ETAG
ecgFIFO = ecg_read_reg(
ECG_FIFO); // Read FIFO
ecgSample[readECGSamples] =
ecgFIFO >>
8; // Isolate voltage data
ETAG[readECGSamples] =
(ecgFIFO >> 3) &
ETAG_BITS_MASK; // Isolate ETAG
readECGSamples++; // Increment sample counter
// Check that sample is not last sample in FIFO
} while ( ETAG[readECGSamples-1] == FIFO_VALID_SAMPLE_MASK ||
ETAG[readECGSamples-1] == FIFO_FAST_SAMPLE_MASK );
} while (ETAG[readECGSamples - 1] ==
FIFO_VALID_SAMPLE_MASK ||
ETAG[readECGSamples - 1] ==
FIFO_FAST_SAMPLE_MASK);
// Check if FIFO has overflowed
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");
// notifies the user that an over flow occured
//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)
while (1) {
ticks = xTaskGetTickCount();
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");
vTaskDelayUntil(&xLastWakeTime, (configTICK_RATE_HZ * 60));
}
......@@ -274,7 +275,8 @@ void vCmdLineTask(void *pvParameters)
fflush(stdout);
while (1) {
/* 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");
vTaskDelay(portMAX_DELAY);
}
......@@ -297,18 +299,26 @@ void vCmdLineTask(void *pvParameters)
printf("^C");
printf("\ncmd> ");
fflush(stdout);
} else if ((tmp == '\r') ||
(tmp == '\n')) {
} else if ((tmp == '\r') || (tmp == '\n')) {
printf("\r\n");
/* Null terminate for safety */
buffer[index] = 0x00;
/* Evaluate */
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
* 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));
}
} while (xMore != pdFALSE);
......@@ -326,8 +336,14 @@ void vCmdLineTask(void *pvParameters)
fflush(stdout);
}
/* If more characters are ready, process them here */
} while ((UART_NumReadAvail(MXC_UART_GET_UART(CONSOLE_UART)) > 0) &&
UART_Read(MXC_UART_GET_UART(CONSOLE_UART), (uint8_t *)&tmp, 1, NULL));
} while ((UART_NumReadAvail(MXC_UART_GET_UART(
CONSOLE_UART)) > 0) &&
UART_Read(
MXC_UART_GET_UART(CONSOLE_UART),
(uint8_t *)&tmp,
1,
NULL)
);
}
}
}
......@@ -365,15 +381,13 @@ void RTC_IRQHandler(void)
int main(void)
{
#if configUSE_TICKLESS_IDLE
uart_cfg_t uart_cfg = {
.parity = UART_PARITY_DISABLE,
uart_cfg_t uart_cfg = { .parity = UART_PARITY_DISABLE,
.size = UART_DATA_SIZE_8_BITS,
.stop = UART_STOP_1,
.flow = UART_FLOW_CTRL_DIS,
.pol = UART_FLOW_POL_DIS,
.baud = 115200,
.clksel = UART_CLKSEL_SYSTEM
};
.clksel = UART_CLKSEL_SYSTEM };
sys_cfg_uart_t uart_sys_cfg = { MAP_A, Enable };
/* The RTC must be enabled for tickless operation */
......@@ -389,7 +403,9 @@ int main(void)
#endif
/* 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
printf("Tickless idle is configured. Type 'tickless 1' to enable.\n");
#endif
......@@ -400,14 +416,35 @@ int main(void)
printf("xSemaphoreCreateMutex failed to create a mutex.\n");
} else {
/* Configure task */
if ((xTaskCreate(vTask0, (const char *)"Task0",
configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, NULL) != 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)) {
if ((xTaskCreate(
vTask0,
(const char *)"Task0",
configMINIMAL_STACK_SIZE,
NULL,
tskIDLE_PRIORITY + 1,
NULL) != 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");
} else {
/* 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 @@
#include "leds.h"
#include "card10.h"
#include "GUI_Paint.h"
#include "gfx.h"
#include "display.h"
#include "tmr_utils.h"
......@@ -19,7 +20,8 @@
/***** Definitions *****/
/***** 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)
{
......@@ -28,11 +30,19 @@ int main(void)
card10_init();
card10_diag();
Paint_DrawImage(Heart, 0, 0, 160, 80);
LCD_Update();
gfx_copy_region(
&display_screen,
0,
0,
160,
80,
GFX_RGB565,
(const void *)(Heart)
);
gfx_update(&display_screen);
for (int i = 0; i < 11; i++) {
leds_set_dim(i, 1);
// leds_set_dim(i, 1);
}
int __attribute__((unused)) h = 0;
......
file ../../build/hw-tests/imutest/imutest.elf
source ../../.gdbinit
source ../../init.gdb
file ../../build/hw-tests/imutest/imutest.elf