Skip to content
Snippets Groups Projects
Select Git revision
  • 494d30a96b57ee027e5849823a9cd1939070babd
  • master default protected
  • backslash
  • nickname-match-configs
  • genofire/leds_rgb_get_state
  • genofire/rockets-state
  • genofire/ble-follow-py
  • plaetzchen/ios-workaround
  • blinkisync-as-preload
  • genofire/haule-ble-fs-deactive
  • schneider/max30001-pycardium
  • schneider/max30001-epicaridum
  • schneider/max30001
  • schneider/stream-locks
  • ios-workarounds
  • schneider/fundamental-test
  • schneider/ble-buffers
  • schneider/maxim-sdk-update
  • ch3/splashscreen
  • koalo/bhi160-works-but-dirty
  • koalo/wip/i2c-for-python
  • 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
34 results

card10.c

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    card10.c 5.72 KiB
    #include "pmic.h"
    #include "bosch.h"
    #include "display.h"
    #include "portexpander.h"
    
    #include "bhy_uc_driver.h"
    #include "Bosch_PCB_7183_di03_BMI160_BMM150-7183_di03.2.1.11696_170103.h"
    #include "bme680.h"
    #include "bma400.h"
    #include "bhy.h"
    #include "leds.h"
    
    #include "mxc_config.h"
    #include "board.h"
    #include "pb.h"
    
    #include "tmr_utils.h"
    #include "i2c.h"
    #include "rtc.h"
    #include "spi.h"
    #include "gpio.h"
    
    #include <stdio.h>
    #include <stdint.h>
    #include <string.h>
    
    #define SPI_SPEED (15 * 1000 * 1000) // Bit Rate
    
    const gpio_cfg_t bhi_interrupt_pin = {
    	PORT_0, PIN_13, GPIO_FUNC_IN, GPIO_PAD_PULL_UP
    };
    
    void card10_init(void)
    {
    	printf("card10 init...\n");
    
    	//Setup the I2CM
    	I2C_Shutdown(MXC_I2C0_BUS0);
    	I2C_Init(MXC_I2C0_BUS0, I2C_FAST_MODE, NULL);
    
    	I2C_Shutdown(MXC_I2C1_BUS0);
    	I2C_Init(MXC_I2C1_BUS0, I2C_FAST_MODE, NULL);
    
    	portexpander_init();
    
    	GPIO_Init();
    
    	PB_Init();
    
    	pmic_init();
    	pmic_set_led(0, 0);
    	pmic_set_led(1, 0);
    	pmic_set_led(2, 0);
    	TMR_Delay(MXC_TMR0, MSEC(1000), 0);
    
    	while (RTC_EnableRTCE(MXC_RTC) == E_BUSY)
    		;
    
    	// Enable 32 kHz output
    	while (RTC_SquareWave(
    		       MXC_RTC,
    		       SQUARE_WAVE_ENABLED,
    		       F_32KHZ,
    		       NOISE_IMMUNE_MODE,
    		       NULL) == E_BUSY
    	)
    		;
    	/* If we don't have a valid time yet, set it to 2019-01-01 */
    	if (RTC_GetSecond() < 1546300800UL) {
    		while (RTC_Init(MXC_RTC, 1546300800UL, 0, NULL) == E_BUSY)