Skip to content
Snippets Groups Projects
Select Git revision
  • f012c7f7716699097bff8e619ef4a79f9a0db58f
  • master default protected
  • fix-warnings
  • tvbgone-fixes
  • genofire/ble-follow-py
  • schneider/ble-stability-new-phy-adv
  • schneider/ble-stability
  • msgctl/gfx_rle
  • schneider/ble-stability-new-phy
  • add_menu_vibration
  • plaetzchen/ios-workaround
  • blinkisync-as-preload
  • schneider/max30001-pycardium
  • schneider/max30001-epicaridum
  • schneider/max30001
  • schneider/stream-locks
  • schneider/fundamental-test
  • schneider/ble-buffers
  • schneider/maxim-sdk-update
  • ch3/splashscreen
  • koalo/bhi160-works-but-dirty
  • v1.11
  • v1.10
  • v1.9
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
36 results

col_deque.py

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    main.c 5.21 KiB
    #include <stdio.h>
    #include <stddef.h>
    #include <stdbool.h>
    #include <string.h>
    
    #include "mxc_config.h"
    #include "mxc_sys.h"
    #include "mxc_delay.h"
    #include "flc.h"
    #include "icc.h"
    #include "crc.h"
    #include "board.h"
    #include "led.h"
    #include "ff.h"
    #include "crc16-ccitt.h"
    
    
    #define GPIO_PORT_IN                PORT_1
    #define GPIO_PIN_IN                 PIN_6
    
    
    #define PARTITION_START (0x10000000 + 64 * 1024)
    #define PARTITION_END (0x10000000 + 512 * 1024 - 1) /* TODO: check if 1 MB also works. Might have to enable the second bank */
    //#define PARTITION_END (0x10000000 + 1024 * 1024 - 1)
    
    extern void run_usbmsc(void);
    
    DIR dir;
    FATFS FatFs;
    
    bool mount(void)
    {
        FRESULT res;
        res=f_mount(&FatFs,"/",0);
        if(res != FR_OK) {
            printf("f_mount error %d\n", res);
            return false;
        }
    
        res = f_opendir(&dir, "0:");
        if(res != FR_OK) {
            printf("f_opendir error %d\n", res);
            return false;
        }
    
        return true;
    }
    
    bool check_integrity(void)
    {
        FIL file;
        UINT readbytes;
        char *filename = "card10.bin";
        uint8_t data[512];
        FRESULT res;
    
        res=f_open(&file, filename, FA_OPEN_EXISTING|FA_READ);
        if(res != FR_OK) {
            printf("f_open error %d\n", res);
            return false;
        }
    
        uint16_t crcval = 0;
        do {
            res = f_read(&file, data, sizeof(data), &readbytes);
            if(res != FR_OK) {
                printf("f_read error %d\n", res);
                crcval = 1; // Make sure to fail the test
                break;
            }