solderparty / keyboard_featherwing_sw

Creative Commons Zero v1.0 Universal
21 stars 3 forks source link

Rev. 2.0 ALS not functioning, TSC2004 library buffer blocks BBQ10 #1

Open S0U1SB4N3 opened 2 years ago

S0U1SB4N3 commented 2 years ago

the ALS does not work when doing analogRead(A5) the hello_feather.ino if loaded onto a Adafruit Huzzah 32 feather the touch screen buffer is the same buffer as the BBQ10 keyboard so you type and nothing happens but if you touch the screen then during the pressing of the screen it will type what you keyed in.

if i disable the touchscreen then the keyboard functions as desired but you lose the touchscreen capabilities.

KCNilssen commented 2 years ago

Same problem here. I cant seem to get the ALS working as well

arturo182 commented 2 years ago

Hi, sorry I missed the original issue, somehow I had notifications for all solder party repos turned off by default (???)

I have pushed a fix for the TSC issue just now: https://github.com/solderparty/arduino_tsc2004

For the ALS, I have verified it using a SAMD51 Feather and an RP2040 Feather. Unsure about the ESP32 Feather, but I do have a vague memory that you can't use ADC and Wi-Fi at the same time? https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/peripherals/adc.html

image

KCNilssen commented 2 years ago

I am using the Unexpected Maker FeatherS2 board. This is a basic example of what I used to get the ALS working for me. Since this also uses ADC1 instead of ADC2, this approach will also work with wifi enabled on the ESP32-s2.

#include <driver/adc.h>

void setup() {
  // put your setup code here, to run once:
  esp_err_t config_width_response, config_channel_atten_responce;

  config_width_response = adc1_config_width(ADC_WIDTH_BIT_13);

  if ( config_width_response == ESP_OK ) {
    Serial.println(F("adc1_config_width(ADC_WIDTH_BIT_13): ESP_OK"));
    config_channel_atten_responce = adc1_config_channel_atten(ADC1_CHANNEL_4, ADC_ATTEN_DB_0);

    if ( config_channel_atten_responce == ESP_OK ) {
      Serial.println(F("adc1_config_channel_atten(ADC1_CHANNEL_4, ADC_ATTEN_DB_0): ESP_OK"));
    } else {
      Serial.println(F("adc1_config_channel_atten(ADC1_CHANNEL_4, ADC_ATTEN_DB_0):  ESP_ERR_INVALID_ARG Parameter error"));
    }
  } else {
    Serial.println(F("adc1_config_width(ADC_WIDTH_BIT_13): ESP_ERR_INVALID_ARG Parameter error"));    
  }
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println(adc1_get_raw(ADC1_CHANNEL_4));
}