mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
* Basic Init * Rought implementation of fs2711 usb pd interface * Rought implementation of fs2711 usb pd interface * Still needs work overcurrent protection keeps getting tripped * New pdo selection logic * Update push.yml * Update push.yml * Update push.yml * Update Makefile * Adds PPS * Removed unused define * Adds PPS * Apply suggestions from code review Co-authored-by: Ben V. Brown <5425387+Ralim@users.noreply.github.com> * Code review changes * Added osDelay include * New line alignment for S60 softwarei2c * Code review * Fixes code review stuff * code review changes * Change voltage limit to 20 as that's what the device is rated for * Shortened wait time for usb pd * Fixed issues that cuase S60P to restart constantly * fixing minimal OLED brightness With the current settings, the OLED turns off if the first level is selected. * Adds protocol to s60p debug menu * loosened fs2711 protocol selection timing * Adds PDO register reading to negotiation logic * Fixes FS2711 timeout issue and cleans up driver * Adds FS2711 protocol negotiation to power loop * Removed uneeded define * Reverts changes to Font.h and adds clang-format comments --------- Co-authored-by: Ben V. Brown <Ralim@Ralimtek.com> Co-authored-by: discip <53649486+discip@users.noreply.github.com> Co-authored-by: Ben V. Brown <5425387+Ralim@users.noreply.github.com>
62 lines
1.4 KiB
C++
62 lines
1.4 KiB
C++
#include "configuration.h"
|
|
#ifndef _DRIVERS_FS2711_HPP_
|
|
#define _DRIVERS_FS2711_HPP_
|
|
// #define POW_PD_EXT 2
|
|
#if POW_PD_EXT == 2
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
typedef struct {
|
|
uint8_t pdo_num; // Nums of USB-PD Objects max of 7
|
|
uint16_t source_current;
|
|
uint16_t source_voltage;
|
|
uint16_t req_pdo_num;
|
|
uint16_t pdo_type[7];
|
|
uint16_t pdo_min_volt[7];
|
|
uint16_t pdo_max_volt[7];
|
|
uint16_t pdo_max_curr[7];
|
|
} fs2711_state_t;
|
|
|
|
class FS2711 {
|
|
public:
|
|
static bool probe();
|
|
|
|
static void start();
|
|
|
|
static bool open_pps(uint8_t PDOID, uint16_t volt, uint16_t max_curr);
|
|
|
|
static bool open_pd(uint8_t PDOID);
|
|
|
|
static void negotiate();
|
|
|
|
static bool has_run_selection();
|
|
|
|
static uint16_t source_voltage();
|
|
|
|
static uint16_t source_currentx100();
|
|
|
|
static uint8_t selected_protocol();
|
|
|
|
static void pdo_update();
|
|
|
|
static uint8_t debug_protocol();
|
|
static uint16_t debug_pdo_max_voltage(uint8_t pdoid);
|
|
static uint16_t debug_pdo_min_voltage(uint8_t pdoid);
|
|
static uint16_t debug_pdo_source_current(uint8_t pdoid);
|
|
static uint16_t debug_pdo_type(uint8_t pdoid);
|
|
static fs2711_state_t debug_get_state();
|
|
|
|
private:
|
|
// Internal state of IC
|
|
static fs2711_state_t state;
|
|
|
|
static void enable_protocol(bool enable);
|
|
|
|
static void select_protocol(uint8_t protocol);
|
|
|
|
static void enable_voltage();
|
|
};
|
|
|
|
#endif
|
|
#endif
|