rushabhcodes/simple-usb-c-pd-peltier-driver

Reference-based four-layer USB-C PD Peltier driver with RP2040 control, adjustable voltage/current limits, fan power and temperature probes.

Version
0.3.1
License
MIT
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone rushabhcodes/simple-usb-c-pd-peltier-driver  # download the package files into ./simple-usb-c-pd-peltier-driver
tsci add rushabhcodes/simple-usb-c-pd-peltier-driver    # add it to your project as @tsci/rushabhcodes.simple-usb-c-pd-peltier-driver

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

firmware/include/session.h

#ifndef GENERAL_PD_SESSION_H
#define GENERAL_PD_SESSION_H
#include <stdbool.h>
#include <stdint.h>
typedef struct {
  bool pending, safety_latched, ready_previous;
  uint32_t ready_since, absent_since;
} pd_session;
void pd_session_init(pd_session *session, bool has_profile, bool safety_latched);
void pd_session_cancel(pd_session *session);
void pd_session_fault(pd_session *session, bool protective);
void pd_session_clear(pd_session *session);
bool pd_session_tick(pd_session *session, bool ready, bool saved_valid, uint32_t now);
#endif