Skip to content

Commit

Permalink
Merge up-master into release for v3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SPRESENSE authored Nov 7, 2023
2 parents d52d067 + 1050fa4 commit 0b72948
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ void HardwareSerial::begin(unsigned long baud, uint16_t config)
return;
tio.c_speed = baud;

// Remove CR to NL conversion
tio.c_iflag &= ~ICRNL;

// Disable ECHO
tio.c_lflag &= ~ECHO;

// Convert config to c_cflag in the termios structure
tcflag_t c_cflag = 0;
switch (config & MY_CSIZE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void setupUSB() { }
void serialEventRun(void);
void serialEvent(void);

int spresense_main(void)
int spresense_main(int argc, char *argv[])
{
int r = boardctl(BOARDIOC_INIT, 0);
if (r) printf("WARNING: Something wrong during board initialization\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ int sync_printf(const char *fmt, ...)
lib_memoutstream(&memoutstream, buf, sizeof(buf));

va_start(ap, fmt);
n = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public, fmt, ap);
n = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.common, fmt, ap);
va_end(ap);

uart_syncwrite(buf, n);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <sched.h>
#include <errno.h>
#include <assert.h>
#include <sys/ioctl.h>

#include <Camera.h>
#include <arch/board/cxd56_imageproc.h>
Expand Down Expand Up @@ -501,28 +502,19 @@ CameraClass CameraClass::getInstance()

// Public : Constructor.
CameraClass::CameraClass(const char *path)
: video_fd(-1), video_init_stat(-1), video_buf_num(0),
video_pix_fmt(CAM_IMAGE_PIX_FMT_NONE),
still_pix_fmt(CAM_IMAGE_PIX_FMT_NONE),
video_imgs(NULL), still_img(NULL),
loop_dqbuf_en(false), video_cb(NULL),
frame_tid(-1), frame_exchange_mq(-1), dq_tid(-1)
{
video_init_stat = isx019_initialize();
video_init_stat += isx012_initialize();
video_init_stat += cxd56_cisif_initialize();
video_init_stat += video_initialize(path);
video_fd = -1;
video_imgs = NULL;
video_buf_num = 0;
video_pix_fmt = CAM_IMAGE_PIX_FMT_NONE;
still_img = NULL;
still_pix_fmt = CAM_IMAGE_PIX_FMT_NONE;
loop_dqbuf_en = false;
video_cb = NULL;
dq_tid = -1;
frame_tid = -1;
sem_init(&video_cb_access_sem, 0, 1);
}

// Public : Destructor.
CameraClass::~CameraClass()
{
video_uninitialize();
CameraClass::instance = NULL;
}

Expand Down Expand Up @@ -879,14 +871,19 @@ CamErr CameraClass::begin(int buff_num, CAM_VIDEO_FPS fps, int video_width, int
return CAM_ERR_INVALID_PARAM;
}

if (video_init_stat)
if (video_fd >= 0)
{
return CAM_ERR_NO_DEVICE;
return CAM_ERR_ALREADY_INITIALIZED;
}

if (video_fd >= 0)
video_init_stat = isx019_initialize();
video_init_stat += isx012_initialize();
video_init_stat += cxd56_cisif_initialize();
video_init_stat += video_initialize(VIDEO_DEV_FILE_NAME);

if (video_init_stat)
{
return CAM_ERR_ALREADY_INITIALIZED;
return CAM_ERR_NO_DEVICE;
}

video_fd = open(VIDEO_DEV_FILE_NAME, 0);
Expand Down Expand Up @@ -1300,6 +1297,8 @@ void CameraClass::end()
DELETE_CAMIMAGE(still_img);

imageproc_finalize();

video_uninitialize(VIDEO_DEV_FILE_NAME);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ SPIClass SPI3(SPIDEV_PORT_3);
/**
* @brief Reverse bits.
*/
static inline uint8_t reverse_bits(uint8_t data) inline_function;
static inline uint8_t reverse_bits(uint8_t data) always_inline_function;
static inline uint8_t reverse_bits(uint8_t data)
{
return (((data & 0x01) << 7) | ((data & 0x02) << 5) | ((data & 0x04) << 3) | ((data & 0x08) << 1) |
Expand Down

0 comments on commit 0b72948

Please sign in to comment.