Skip to content
Snippets Groups Projects
Select Git revision
  • d2958d418bce4e2068bb401036f29695d836d0f1
  • 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

meson.build

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    pmic.c 2.85 KiB
    #include "i2c.h"
    #include "pmic.h"
    #include "MAX77650-Arduino-Library.h"
    #include <stdint.h>
    #include <stdio.h>
    
    void pmic_init(void)
    {
        uint8_t didm = MAX77650_getDIDM();
        uint8_t cid = MAX77650_getChipID();
        printf("MAX7765x DIDM: 0x%02x CID: 0x%02x\n", didm, cid);
    
        //MAX77650_setIP_SBB0(0b11);  //Limit output of SBB0 to 500mA
        MAX77650_setTV_SBB0(0b101000); //Set output Voltage of SBB0 to 1.8V
        MAX77650_setADE_SBB0(0b0); //Disable Active Discharge at SBB0 Output
        MAX77650_setEN_SBB0(0b110); //Enable SBB0 is on irrespective of FPS whenever the on/off controller is in its "On via Software" or "On via On/Off Controller" states
    
        //MAX77650_setIP_SBB1(0b11);  //Limit output of SBB1 to 500mA
    #if BOARD_EVKIT
        MAX77650_setTV_SBB1(0b100000); //Set output Voltage of SBB1 to 1.2V
    #else
        MAX77650_setTV_SBB1(0b001001); //Set output Voltage of SBB1 to 3.3V
    #endif
        MAX77650_setADE_SBB1(0b0); //Disable Active Discharge at SBB1 Output
        MAX77650_setEN_SBB1(0b110); //Enable SBB1 is on irrespective of FPS whenever the on/off controller is in its "On via Software" or "On via On/Off Controller" states
    
        //MAX77650_setIP_SBB2(0b11);  //Limit output of SBB2 to 500mA
    #if BOARD_EVKIT
        MAX77650_setTV_SBB2(0b110010); //Set output Voltage of SBB2 to 3.3V
    #else
        MAX77650_setTV_SBB2(0b110100); //Set output Voltage of SBB2 to 5.0V
    #endif
        MAX77650_setADE_SBB2(0b0); //Disable Active Discharge at SBB2 Output
        MAX77650_setEN_SBB2(0b110); //Enable SBB2 is on irrespective of FPS whenever the on/off controller is in its "On via Software" or "On via On/Off Controller" states
    
        // Prepare the PMIC LEDs
        MAX77650_setLED_FS0(0b11);
        MAX77650_setINV_LED0(false);    //LED red: phase operation
        MAX77650_setBRT_LED0(0b00000);  //LED red: brightness
        MAX77650_setP_LED0(0b1111);     //LED red: LED period
        MAX77650_setD_LED0(0b1111);     //LED red: LED duty-cycle
    
        MAX77650_setLED_FS1(0b11);
        MAX77650_setINV_LED1(false);    //LED green: phase operation
        MAX77650_setBRT_LED1(0b00000);  //LED green: brightness
        MAX77650_setP_LED1(0b1111);     //LED green: LED period
        MAX77650_setD_LED1(0b1111);     //LED green: LED duty-cycle
    
        MAX77650_setLED_FS2(0b11);
        MAX77650_setINV_LED2(false);    //LED blue: phase operation
        MAX77650_setBRT_LED2(0b00000);  //LED blue: brightness
        MAX77650_setP_LED2(0b1111);     //LED blue: LED period
        MAX77650_setD_LED2(0b1111);     //LED blue: LED duty-cycle
    
        MAX77650_setEN_LED_MSTR(true);  //LEDs Master enable
    }
    
    void pmic_set_led(uint8_t led, uint8_t val)
    {
        if(led == 0) {
            MAX77650_setLED_FS0(val > 0 ? 0b01 : 0);
            MAX77650_setBRT_LED0(val);
        }
        if(led == 1) {
            MAX77650_setLED_FS1(val > 0 ? 0b01 : 0);
            MAX77650_setBRT_LED1(val);
        }
        if(led == 2) {
            MAX77650_setLED_FS2(val > 0 ? 0b01 : 0);
            MAX77650_setBRT_LED2(val);
        }
    
    }