Permalink
Browse files

Merge branch 'master' of https://github.com/DangerousPrototypes/bus_p…

  • Loading branch information...
ian
ian committed Sep 13, 2018
2 parents 2f53af5 + 42f05e5 commit d68bd6ecd64ba1823aafadaffa73d94cadd74560
Showing with 41 additions and 1 deletion.
  1. +1 −0 source/1WIRE.c
  2. +40 −1 source/selftest.c
View
@@ -2,6 +2,7 @@
// took 1wire implementation from old buspirate
// fiddled a bit with the timings to make it work on the NG version
//
#include <stdint.h>
#include <libopencm3/stm32/gpio.h>
View
@@ -14,7 +14,7 @@
// pins directly tested
#define DIRECT_PIN_TESTS_PP 9
#define DIRECT_PIN_TESTS_OD 7
#define DIRECT_PIN_TESTS_OD 7 // AUX isn't connected through the 4066
struct _testpin testpins[]={
// MOSI
{ GPIOB, GPIOB, GPIO7, GPIO10 }, // mosi PB10
@@ -216,6 +216,45 @@ void selftest(void)
cleanup_spi(); // TODO: needed?
cdcprintf("Selftest ended, found %d errors\r\n", errors);
cdcprintf("Press any key to continue\r\n");
if(cdcgetc()!='t')
return;
cdcprintf("HiZ test on CS\r\n");
gpio_set(BP_VPUEN_PORT, BP_VPUEN_PIN); // enable pullups
gpio_set_mode(GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO12);
cdcprintf("input-float\r\n");
cdcgetc();
gpio_set_mode(GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, GPIO12);
gpio_set(GPIOB, GPIO12);
cdcprintf("input-pull-up\r\n");
cdcgetc();
gpio_set_mode(GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, GPIO12);
gpio_clear(GPIOB, GPIO12);
cdcprintf("input-pull-down\r\n");
cdcgetc();
gpio_set_mode(GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_ANALOG, GPIO12);
cdcprintf("input-analog\r\n");
cdcgetc();
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, GPIO12);
gpio_set(GPIOB, GPIO12);
cdcprintf("output-od-high\r\n");
cdcgetc();
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, GPIO12);
gpio_clear(GPIOB, GPIO12);
cdcprintf("output-od-low\r\n");
cdcgetc();
gpio_set_mode(GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO12);
gpio_clear(BP_VPUEN_PORT, BP_VPUEN_PIN); // disable pullups
}

0 comments on commit d68bd6e

Please sign in to comment.