Skip to content

Commit

Permalink
1. Add new board canmv_k120_zero (#44)
Browse files Browse the repository at this point in the history
* Add support for sensor pgd030k.

* Add new board canmv_k210_zero.

* disable actions run tests
  • Loading branch information
kendryte747 authored Jul 20, 2024
1 parent d2fad69 commit 959328a
Show file tree
Hide file tree
Showing 21 changed files with 2,292 additions and 35 deletions.
70 changes: 35 additions & 35 deletions .github/workflows/build-release-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Build Projects
run: |
projects=("canmv_k1" "canmv_dock" "canmv_k210" "canmv_makerobo" "canmv_dnk210")
projects=("canmv_k1" "canmv_dock" "canmv_k210" "canmv_makerobo" "canmv_dnk210" "canmv_k210_zero")
for proj in ${projects[@]};do
cd projects/${proj}
echo "-------------------"
Expand Down Expand Up @@ -70,43 +70,43 @@ jobs:
artifacts: "release/**.bin"
token: ${{ secrets.GITHUB_TOKEN }}

test:
if: endsWith(github.ref, 'main')
runs-on: self-hosted
needs: build
defaults:
run:
shell: bash
env:
SERIAL_DEV: /dev/ttyACM1
# test:
# if: endsWith(github.ref, 'main')
# runs-on: self-hosted
# needs: build
# defaults:
# run:
# shell: bash
# env:
# SERIAL_DEV: /dev/ttyACM1

steps:
- name: Check Board
run: |
ls ${{ env.SERIAL_DEV }}
if [ $? -ne 0 ]; then
echo "Runner have no board connected."
exit -1
fi
# steps:
# - name: Check Board
# run: |
# ls ${{ env.SERIAL_DEV }}
# if [ $? -ne 0 ]; then
# echo "Runner have no board connected."
# exit -1
# fi

- uses: actions/checkout@v3
# - uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with:
path: ./build
name: "canmv-${{ github.sha }}"
# - uses: actions/download-artifact@v3
# with:
# path: ./build
# name: "canmv-${{ github.sha }}"

- name: Burn Test Firmware
run: |
python3 tools/flash/kflash_py/kflash.py -p ${{ env.SERIAL_DEV }} -b 1500000 build/canmv_k1_standard.bin
# - name: Burn Test Firmware
# run: |
# python3 tools/flash/kflash_py/kflash.py -p ${{ env.SERIAL_DEV }} -b 1500000 build/canmv_k1_standard.bin

- name: Run Tests
run: |
cd tools/tests
python3 run-tests.py --target k210 --device ${{ env.SERIAL_DEV }} --baudrate 115200
cd -
# - name: Run Tests
# run: |
# cd tools/tests
# python3 run-tests.py --target k210 --device ${{ env.SERIAL_DEV }} --baudrate 115200
# cd -

- uses: actions/upload-artifact@v3
with:
name: "canmv-test-results-${{ github.sha }}"
path: tools/tests/results
# - uses: actions/upload-artifact@v3
# with:
# name: "canmv-test-results-${{ github.sha }}"
# path: tools/tests/results
18 changes: 18 additions & 0 deletions components/micropython/port/src/omv/cambus.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "gc0328.h"
#include "gc2145.h"
#include "mt9d111.h"
#include "pgd030k.h"

#include "py/mpprint.h"
#include "sysctl.h"
#include "fpioa.h"
Expand Down Expand Up @@ -263,6 +265,22 @@ int cambus_scan_mt9d111(void)
return id;
}

int cambus_scan_pgd030k(void)
{
uint8_t id_h = 0, id_l = 0;
uint16_t id = 0;

sccb_reg_width = 8;

sccb_i2c_write_byte(i2c_device, PGD030K_I2C_ADDR, 0x03, sccb_reg_width, 0x00, 10); // Bank A
sccb_i2c_read_byte(i2c_device, PGD030K_I2C_ADDR, 0x00, sccb_reg_width, &id_h, 10); // Device ID High
sccb_i2c_read_byte(i2c_device, PGD030K_I2C_ADDR, 0x01, sccb_reg_width, &id_l, 10); // Device ID Low

id = (id_h << 8) | id_l;

return (PGD030K_ID_CODE == id) ? PGD030K_ID_CODE : 0x00;
}

int cambus_readb(uint8_t slv_addr, uint16_t reg_addr, uint8_t *reg_data)
{

Expand Down
1 change: 1 addition & 0 deletions components/micropython/port/src/omv/cambus.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ int cambus_scan();
int cambus_scan_gc0328(void);
int cambus_scan_gc2145(void);
int cambus_scan_mt9d111(void);
int cambus_scan_pgd030k(void);
int cambus_readb(uint8_t slv_addr, uint16_t reg_addr, uint8_t *reg_data);
void cambus_set_writeb_delay(uint32_t delay);
int cambus_writeb(uint8_t slv_addr, uint16_t reg_addr, uint8_t reg_data);
Expand Down
38 changes: 38 additions & 0 deletions components/micropython/port/src/omv/include/pgd030k.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* mt9d111.h
*
* Copyright (C) 2018, Gabriel Mariano Marcelino <[email protected]>
*
* This file is part of MT9D111-Driver.
*
* MT9D111-Driver is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MT9D111-Driver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MT9D111-Driver. If not, see <http://www.gnu.org/licenses/>.
*
*/

#ifndef PGD030K_H
#define PGD030K_H

#include <stdint.h>

#include "sensor.h"

// I2C addresses
#define PGD030K_I2C_ADDR 0x33 /* DVP, fixed to 0x66 */

// Device ID code
#define PGD030K_ID_CODE 0xD030

int pgd030k_init(sensor_t *sensor);

#endif // PGD030K_H
Loading

0 comments on commit 959328a

Please sign in to comment.