max4619: extra pin

This commit is contained in:
Triss 2022-04-02 05:15:45 +02:00
parent 18a0277284
commit d646d9ad14
4 changed files with 14 additions and 3 deletions

View File

@ -25,9 +25,10 @@ static inline void zap_init(enum zap_component zc) {
if (zc & zap_crowbar) zap_crowbar_init();
if (zc & zap_dac) zap_dac_init();
if (zc & zap_gpio) zap_gpio_init(false, true);
if (zc & zap_max4619) zap_max_init(false);
if (zc & zap_max4619) zap_max_init(false, false);
if (zc & zap_picoemp) zap_picoemp_init();
}
// TODO: deinit stuff (also in submodules)
static inline void zap_init_default(void) {
zap_init(zap_adc | zap_crowbar | zap_dac | zap_gpio | zap_max4619);

View File

@ -8,7 +8,7 @@
#include "zap_max4619.h"
void zap_max_init(bool inhibit) {
void zap_max_init(bool inhibit, bool use_jp300) {
const io_rw_32 pinmask = 1u << ZAP_GLITCH_OUT;
sio_hw->gpio_clr = pinmask; // default to low -> JP300
@ -18,6 +18,10 @@ void zap_max_init(bool inhibit) {
gpio_set_drive_strength(ZAP_GLITCH_OUT, GPIO_DRIVE_STRENGTH_12MA);
gpio_set_function(ZAP_GLITCH_OUT, GPIO_FUNC_SIO);
gpio_put(ZAP_MAX_VHI_SW, use_jp300);
gpio_set_dir(ZAP_MAX_VHI_SW, GPIO_OUT);
gpio_set_function(ZAP_MAX_VHI_SW, GPIO_FUNC_SIO);
gpio_put(ZAP_MAX_INHIBIT, inhibit);
gpio_set_dir(ZAP_MAX_INHIBIT, GPIO_OUT);
gpio_set_function(ZAP_MAX_INHIBIT, GPIO_FUNC_SIO);

View File

@ -8,13 +8,18 @@
#include "zap_pinout.h"
void zap_max_init(bool inhibit);
void zap_max_init(bool inhibit, bool use_jp300);
static inline void zap_max_set_inhibit(bool inhibit) {
if (inhibit) sio_hw->gpio_set = 1u << ZAP_MAX_INHIBIT;
else sio_hw->gpio_clr = 1u << ZAP_MAX_INHIBIT;
}
static inline void zap_max_use_vhi_jp300(bool use_jp300 /* if false: use Vdac1 */) {
if (use_jp300) sio_hw->gpio_set = 1u << ZAP_MAX_VHI_SW;
else sio_hw->gpio_clr = 1u << ZAP_MAX_VHI_SW;
}
static inline void zap_max_put(bool low) {
if (low) sio_hw->gpio_set = 1u << ZAP_GLITCH_OUT;
else sio_hw->gpio_clr = 1u << ZAP_GLITCH_OUT;

View File

@ -12,6 +12,7 @@
#define ZAP_CROWBAR_2 13
#define ZAP_MAX_INHIBIT 16
#define ZAP_MAX_VHI_SW 21
#define ZAP_GPIO_ENABLE 22
#define ZAP_DAC_SPI spi0